Click here to Skip to main content
16,015,756 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I do not understand this meaning
C#
public int State { get; set; } = -0;

I see this line of code at this link

What I have tried:

I searched but did not find something useful about it
Posted
Updated 18-Feb-23 19:56pm
v2
Comments
Richard MacCutchan 19-Feb-23 3:10am    
It is a way of setting an initial value in a property field.

1 solution

Because it is an integer, there is no difference in C# between 0 and -0 - the internal representation is the same: 32 bits which are all zero.

For floating point values the internal representation of 0.0 and -0.0 is different, but they are equal values and an equality test will confirm that.

It's possible it was originally "-1" and the author changed the number and forgot the sign.
 
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