------解决方案-------------------- 没太明白什么意思?
是下面这个意思吗?
public class cmyclall
{
public cmycall()
{}
}
public class arList
{
public cmycall mobj
{get;set;}
}
public class Test
{
public static void Main()
{ arList []arlist=new arList[]{new arList{mobj=new cmycall()},new arList{mobj=new cmycall()},new arList{mobj=new cmycall()}};
for(int i=0;i<arlist.Length;i++)
cmyclall Gobj=arlist[i].mobj;
}
} ------解决方案-------------------- 使用索引器
class MyClass
{
public YourType this[int Index]
{
get { ... } set { ... }
}
}
使用
MyClass mc = new MyClass();
var val = mc[1]; ------解决方案--------------------