public struct CStruct
{
public List<Point> cList;
public bool hr;
public int fr;
public Point st;
public int ht;
public int wh;
public int a;
}
static void FetchSingleContours(Point t, List<CStruct> seqCStruct)
{
CStruct st;
st.cList =new List<Point>();
st.st = new point(10,10);
......
st.ht = 10;
st.wh =20;
st.a = 30;
seqCStruct.Add(st);
}
为什么提示使用了未赋值的st 呢?真的很奇怪啊
还有什么更好的方法存储我自己定义的这种数据结构呢?
{
public List<Point> cList;
public bool hr;
public int fr;
public Point st;
public int ht;
public int wh;
public int a;
}
static void FetchSingleContours(Point t, List<CStruct> seqCStruct)
{
CStruct st;
st.cList =new List<Point>();
st.st = new point(10,10);
......
st.ht = 10;
st.wh =20;
st.a = 30;
seqCStruct.Add(st);
}
为什么提示使用了未赋值的st 呢?真的很奇怪啊
还有什么更好的方法存储我自己定义的这种数据结构呢?
问题是我去翻了好几本书 都没 new的啊!唉
但是我还是去翻阅了下书,我不迷信书
大家可以去看C#入门经典(4版)第84页
书上的例程 是没有new 直接赋值了就能用了!
所以我就这样做了,大家别拍我,问出这么低级的问题 我真的很难受!唉
CStruct st = new CStruct();
或者CStruct st = 某个值;