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; }
Developer technologies | .NET | .NET Runtime
Developer technologies | .NET | .NET Runtime
.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
Answer accepted by question author
-
Bruce (SqlWork.com) 82,061 Reputation points Volunteer Moderator
2022-10-12T15:46:16.423+00:00
1 additional answer
Sort by: Most helpful
-
Olaf Helper 47,586 Reputation points2022-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