I'm working in python with a c# library I occasionally have to edit. In python, booleans are specified as True/False. In c#, as true/false. This is driving me crazy. Is there a way to use #define or something to make c# recognize True/False as true/false?
Asked
Active
Viewed 621 times
2
-
10`public const bool True = true;` – Quality Catalyst Jul 01 '15 at 22:23
-
4@QualityCatalyst has your best answer, but it's bad practice all around to do this kind of thing (it will confuse anyone who reads your code). Just use `True` and `False` like a good Microsoft customer. – Sam Estep Jul 01 '15 at 22:31
-
1@QualityCatalyst you might think about moving that comment to an answer. That way others that search this question can find the answer a little easier. – Matt Rowland Jul 02 '15 at 00:16
-
I agree. Pad it a bit and you have a free green check. – Carbon Jul 02 '15 at 04:33
-
Will do, @RedRoboHood. – Quality Catalyst Jul 03 '15 at 08:32
1 Answers
2
One way is to declare a constant that reflects the true
value.
public const bool True = true;
I personally wouldn't go down this path though as it seems to be more like a personal choice. It may confuse other developers and doesn't add general value.

Quality Catalyst
- 6,531
- 8
- 38
- 62