我正在尝试使用 ArrayList,并将其绑定到 BindingList ...
如果我尝试将其放入(我有 Option Strict On),我会收到我实施的转换建议 -
然而,无论我尝试什么,我都会遇到运行时错误。
Unable to cast object of type 'ArrayList' to type 'IList`
编码:
Dim myBoundList As System.ComponentModel.BindingList(Of something) =
New System.ComponentModel.BindingList(Of something)
(CType(myArrayList, System.Collections.Generic.IList(Of something)))
我试图插入 .ToArray ...
链接https://stackoverflow.com/a/8770832/1217150上接受的答案完全相同(即使意图相反),我已经尝试过了......(我的意思是,创建一个 IList 项目, 并赋值
IList iList = new ArrayList();
它给了我同样的错误......
我正在使用 VB.NET,但 c# 也会有所帮助。请帮忙。谢谢你。