I want “(int)null” to return me 0

前端 未结 8 2232
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 14:14

How can i get 0 as integer value from (int)null.

EDIT 1: I want to create a function that will return me default values for null representa

8条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-13 14:51

    You can't cast a null to an int, as an int is a value type. You can cast it to an int? though.

    What is it you want to achieve?

提交回复
热议问题