第一个类
public class MEGrid
{
private MEGridsCollection _mymesc;
public MEGridsCollection Mymesc
{
get { return _mymesc; }
set { _mymesc = value; }
}
}
第二个类
public class MEGridsCollection : List<MEGrids >
{ }
第三个类
public class MEGrids
{
private int _megridid = 0;//普通的一些字段 public int Megridid
{
get { return _megridid; }
set { _megridid = value; }
}
}
MEGrid myme = new MEGrid();
MEGrids mymes = new MEGrids();
//对mymes 做一些属性的赋值操作后,执行下面一句
myme.Mymesc.Add(mymes);//报错:未将对象引用设置到到对象的实例不知道是什么原因,请大家帮忙
public class MEGrid
{
private MEGridsCollection _mymesc;
public MEGridsCollection Mymesc
{
get { return _mymesc; }
set { _mymesc = value; }
}
}
第二个类
public class MEGridsCollection : List<MEGrids >
{ }
第三个类
public class MEGrids
{
private int _megridid = 0;//普通的一些字段 public int Megridid
{
get { return _megridid; }
set { _megridid = value; }
}
}
MEGrid myme = new MEGrid();
MEGrids mymes = new MEGrids();
//对mymes 做一些属性的赋值操作后,执行下面一句
myme.Mymesc.Add(mymes);//报错:未将对象引用设置到到对象的实例不知道是什么原因,请大家帮忙
{
private MEGridsCollection _mymesc = new MEGridsCollection();
public MEGridsCollection Mymesc
{
get { return _mymesc; }
set { _mymesc = value; }
}
}