我来自C#世界到VB.NET,这让我很困惑.为什么有两种方法可以做同样的事情?或者我不知道有什么不同?
以下是有什么区别的:
Public ReadOnly Property Test(ByVal v as String) As Integer
Get
Return SomeOperationOn(v)
End Get
End Property
Run Code Online (Sandbox Code Playgroud)
和
Public Function Test(ByVal v as String) As Integer
Return SomeOperationOn(v)
End Function
Run Code Online (Sandbox Code Playgroud)
你什么时候使用一个而不是另一个?
我正在研究一些工作中的遗留代码,我想知道这两个属性之间有什么区别:
Public Property HasUsedCopies() As Boolean
Public Property HasUsedCopies As Boolean
使用 VB.NET 到 C# 代码转换器,它们是相同的:
public bool HasUsedCopies { get; set; }
括号表示什么?