Overriding Equals method in Structs

前端 未结 6 571
-上瘾入骨i
-上瘾入骨i 2020-12-28 11:24

I\'ve looked for overriding guidelines for structs, but all I can find is for classes.

At first I thought I wouldn\'t have to check to see if the passed object was n

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-28 12:16

    Adding to the existing answers.

    You can still have nullable values if you append a ? after the struct name (this works for every value object)

    int?
    

    Casting is done also by calling (MyStructName)variableName

提交回复
热议问题