Click here to Skip to main content
15,665,319 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just started working with "Midi: A Windows MIDI Library in C#".
What does the following really do? Trying to understand this segment of code:


I understand the definition of what it does but don't know what it "really does". In one file, #if MIDILIB occurs 38 times. The well commented code notes a variety of summaries of what the code that follows each one does, such as:
Represents a MIDI message with a single payload byte.
Creates a MIDI message with the specified status and payload.


What I have tried:

I have looked online and found nothing and even asked ChatGPT.
Updated 3-Feb-23 14:56pm
Gerry Schmitz 3-Feb-23 22:25pm    
It's confusing because #if .. #endif is typically used to include / exclude an entire statement, and not just one "keyword", as in this case. You have to look at the surrounding code to make full sense of it (declaring something as internal vs public).

1 solution

They are C# preprocessor directives | Microsoft Learn[^]
Although the compiler doesn't have a separate preprocessor, the directives described in this section are processed as if there were one. You use them to help in conditional compilation.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900