可空类型修饰符单问号使用

369 369
C#
sam
sam 2024-05-19 16:01:24

在对比如int 赋值的时候直接赋空值是不行的,需要使用?运行符

系统会报错

int a = null

使用单引号则不报错

int a? = null


回帖
  • 消灭零回复