FieldInfo[] fields = typeof(MyDictionary).GetFields();
Run Code Online (Sandbox Code Playgroud)
MyDictionary 是一个静态类,所有字段都是字符串数组.
如何获取每个数组的Length值,然后迭代遍历所有元素?我试过演员像:
field as Array
Run Code Online (Sandbox Code Playgroud)
但它会导致错误
无法通过引用转换,装箱转换,拆箱转换,换行转换或空类型转换将类型'System.Reflection.FieldInfo'转换为'System.Array'