我正在使用 BrightIdeas 软件中的 TreeListView 控件。看起来不错,但我对代表不熟悉,示例是用 c# 编写的。有人可以帮我把它翻译成 VB.NET 吗?
这是一个例子:
this.treeListView.CanExpandGetter = delegate(object x) {
Return ((MyFileSystemInfo) x).IsDirectory;
};
这是我对意图的最佳猜测(显然是错误的)
Dim expander As TreeListView.CanExpandGetterDelegate
expander = AddressOf IsReportPopulated
'// CanExpandGetter Is called very often! It must be very fast.
Me.treeListView.CanExpandGetter = expander(x As Object) ' no idea where we are getting the object from
函数定义如下
Private Function IsReportPopulated(x As Object) As Boolean
Dim myreport As ADCLReport = CType(x, ADCLReport)
If myreport.Chambers.Count > 0 Or myreport.Electrometers.Count > 0 Then Return True
Return False
End Function
根据建议,通过翻译运行。看起来不太对劲。输出:
thisPublic Delegate Sub ((ByVal Unknown As x)
{Return(CType(x,MyFileSystemInfo)).IsDirectory
UnknownUnknown