How does the assignment of the null literal to a System.Nullable type get handled by .Net (C#)?

后端 未结 5 1804
情深已故
情深已故 2021-01-13 13:35

I was wondering if anyone knows how the C# compiler handles the following assignment:

int? myInt = null;

My assumption is that there is an

5条回答
  •  旧巷少年郎
    2021-01-13 13:37

    I would expect .HasValue is set to false and .Value is set to default(T), but I haven't checked that.

提交回复
热议问题