将可空(整数)传递给子或函数
Passing nullable(of integer) to sub or function
我有这个代码:
Dim iwidth As Integer? = 125
Dim iheight As Integer? = 45
Recs.Add(New With {Key .URLSmallPic = "/EditorImage/BBM4.jpg", Key .URL = "#", Key .Width = iwidth, Key .Height = iheight})
Recs 是一个列表变量。
第三个和第四个参数可以为空(整数)。
如何在不声明 iwidth 和 iheight 变量的情况下制作单行代码?
回答你的问题:
Recs.Add(New With {Key .URLSmallPic = "/EditorImage/BBM4.jpg",
Key .URL = "#",
Key .Width = New Nullable(Of Integer)(125),
Key .Height = New Nullable(Of Integer)(45)})
我有这个代码:
Dim iwidth As Integer? = 125
Dim iheight As Integer? = 45
Recs.Add(New With {Key .URLSmallPic = "/EditorImage/BBM4.jpg", Key .URL = "#", Key .Width = iwidth, Key .Height = iheight})
Recs 是一个列表变量。 第三个和第四个参数可以为空(整数)。 如何在不声明 iwidth 和 iheight 变量的情况下制作单行代码?
回答你的问题:
Recs.Add(New With {Key .URLSmallPic = "/EditorImage/BBM4.jpg",
Key .URL = "#",
Key .Width = New Nullable(Of Integer)(125),
Key .Height = New Nullable(Of Integer)(45)})