Does C# has #define thing too? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Does C# has #define thing too?

4th Jun 2018, 5:50 PM
Anil Khatri
Anil Khatri - avatar
2 Answers
+ 3
"The #define directive cannot be used to declare constant values as is typically done in C and C++. Constants in C# are best defined as static members of a class or struct. If you have several such constants, consider creating a separate "Constants" class to hold them." link: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-define
4th Jun 2018, 5:53 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
Thanks man
4th Jun 2018, 5:55 PM
Anil Khatri
Anil Khatri - avatar