我可以在 C# 中轻松地做到这一点......但我需要 VB.Net 中的等价物。我需要能够在 VB.Net 中实现各种 IAsyncResult 属性。
在 C#
像冠军一样工作...
public object AsyncState { get; set; }
在 VB.NET 中 - 这失败了
这失败了,因为您不能在 VB.Net 中重载属性
Public ReadOnly Property AsyncState() As Object Implements IAsyncResult.AsyncState
Get
'... the GET's code goes here ...
End Get
End Property
Public WriteOnly Property AsyncState() As Object
Set(ByVal value As Object)
'... the SET's code goes here ...
End Set
End Property
在 VB.NET 中 - 两者都失败了
这不符合“必须实现 IAsyncResult”的要求
Public AsyncState As Object
Public AsyncState As Object Implements IAsyncResult.AsyncState