"bitwise equality" with value types?

K

KJ

Given a struct containing only primitive members, does "bitwise
equality" mean that it is not necessary to override Object Equals() or
the == operator when all you want to do is determine equivalence by
comparing the values of each primitive in the struct? The docs seem to
suggest this, but I would like a confirmation, if possible.

Thanks.

-KJ
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

It's indeed the way it works, even if there is a reference type if both
structs have the same reference they will be equals
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top