1

在带有 C# 的 MVC3 中,可为空的模型的属性定义为

public int? MyProperty { get; set; }

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

4

3 回答 3

3

Public Property MyProperty As Integer?

于 2012-11-20T15:10:33.083 回答
2
public property MyProperty As Nullable(Of Integer)
于 2012-11-20T15:07:18.680 回答
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

于 2021-04-26T16:33:57.783 回答