如何动态创建类中的变量
盛代 2015-05-27 11:54:18 类结构如下:
public class myclass
{
public string a {get;set;}
public string b {get;set;}
public string c {get;set;}
public string d {get;set;}
public static IList<myclass> myIlist(string array)//array传值:b,c
{
string[] arr = array.Splist(new char[] {','})
IList<myclass> bk = new List<myclass>();
myclass cit = new myclass();
cit.b = "值一";
cit.c = "值二";
bk.Add(cit);
return bk;
}
}
Ilist返回的每一条数据中都会包含:a、b、c、d四个字段的值,如何才能让Ilist每一条数据都只有b、c二个字段呢?