you are looking at swagger's display of sample data. it always sets booleans to true, just as it it uses now for DateTime (which default to minimum)
Boolean is true by default ?
Marc Roussel
41
Reputation points
I created a class with a Boolean. When I instantiate it, my Boolean is true. I don't understand. I thought the default for Boolean was false ! Any ideas ?
Right now, I'm forced to use this attribute :
[
DefaultValue(false)]
public bool IsDelete { get; set; }
Accepted answer
1 additional answer
Sort by: Most helpful
-
Olaf Helper 40,816 Reputation points
2022-10-10T13:01:18.56+00:00 See bool (C# reference): "The default value of the bool type is false"
There must be code setting the property to True