Vb.net System.Collections.ArrayList.ToArray方法为空
我正在尝试获取ToArray方法,但我总是获取null(无) 在网上搜索没有解决办法 编辑:我要生成此查询:Vb.net System.Collections.ArrayList.ToArray方法为空,vb.net,linq,expression-trees,Vb.net,Linq,Expression Trees,我正在尝试获取ToArray方法,但我总是获取null(无) 在网上搜索没有解决办法 编辑:我要生成此查询: Dim test = result.GroupBy(Function(row) groupedindexes.Select( Function(grpindex) row(grpindex)).ToArray, comp) 使用校正后的toarrayMethod我得到图像上的错误: 我知道,我必须更改此部分:GetType(
Dim test = result.GroupBy(Function(row) groupedindexes.Select(
Function(grpindex) row(grpindex)).ToArray, comp)
使用校正后的toarrayMethod
我得到图像上的错误:
我知道,我必须更改此部分:GetType(System.Collections.ArrayList)
我试图更改此部分,但后来我总是得到错误,即方法为null
我想象的是这样的:
Dim toarrayMethod = GetType(System.Func(Of Object(), IEnumerable(Of Object)))...
你能再帮我一次忙吗?没有,这是你通过“ToArray”请求的,新类型(){GetType(Object())}
您正在查找ArrayList.ToArray()
或ArrayList.ToArray(类型)
:
只有一个重载,该参数的类型是
type
而不是Object()
。GetMethod(“ToArray”)应该足够了。仅使用GetMethod(“ToArray”)会给出错误“找到不明确的匹配”。如果我写GetMethod(“ToArray”,New Type(){GetType(Type())}),那么这个方法也算不了什么。那么,您需要传递一个空类型数组:。GetMethod(“ToArray”,New Type(-1){})
顺便说一句,如果可以避免的话,您通常不想使用ArrayList
。相反,您应该使用List
。
Dim toarrayMethod = GetType(System.Func(Of Object(), IEnumerable(Of Object)))...
GetMethod("ToArray")
GetMethod("ToArray", New Type() {GetType(Type())})