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

前端 未结 8 2230
隐瞒了意图╮
隐瞒了意图╮ 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 15:01

    A method of a generic class that returns nothing works:

     Class GetNull(Of T)
          Public Shared Function Value() As T
               Return Nothing
          End Function
     End Class
    
    
    
     Debug.Print(GetNull(Of Integer).Value())
    

提交回复
热议问题