Whats the use of Nullable.GetUnderlyingType, if typeof(int?) is an Int32?

前端 未结 5 2098
萌比男神i
萌比男神i 2021-02-05 16:07

why is typeof int? an Int32

int? x = 1;
Console.WriteLine(x.GetType().Name);

If it is okay then what\'s the use of

5条回答
  •  既然无缘
    2021-02-05 16:28

    When you write int? it's as if you've written Nullable. That's the type you're looking for, I think.

提交回复
热议问题