在MVC3中,如何在vb.Net中设置模型的可空属性?

时间:2012-11-20 15:03:26

标签: vb.net properties c#-to-vb.net

在使用C#的MVC3中,可以为空的Model的属性定义为

public int? MyProperty { get; set; }

但是,我怎样才能用vb.Net语言翻译它?

3 个答案:

答案 0 :(得分:2)

Public Property MyProperty As Integer?

答案 1 :(得分:1)

public property MyProperty As Nullable(Of Integer)

答案 2 :(得分:0)

要对此进行扩展,有 3 种可接受的方式:

Dim ridesBusToWork1? As Boolean
Dim ridesBusToWork2 As Boolean?
Dim ridesBusToWork3 As Nullable(Of Boolean)

此处的更多信息:https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/data-types/nullable-value-types