1
我有兩個對象 1)動態檢索使用屬性作爲其他對象的列表對象的值的值
public class EmailData
{
public int id { get; set; }
public string Urn { get; set; }
public string FileBase { get; set; }
public string EmailFrom { get; set; }
public string EmailTo { get; set; }
public string EmailSubject { get; set; }
public string ContentType { get; set; }
public int Size { get; set; }
}
2)
List<IndexNames> emailIndex = new List<IndexNames>()
{
new IndexNames
{
INDEXDescription = "URN",
INDEXName = "URN",
INDEXNumber = 1
},
new IndexNames
{
INDEXDescription = "EmailFrom",
INDEXName = "EmailFrom",
INDEXNumber = 2
},
new IndexNames
{
INDEXDescription = "EmailTo",
INDEXName = "EmailTo",
INDEXNumber = 3
}
};
我有 列表< EmailData> 與價值。
如何從列表中檢索值(URN,EmailFrom,EmailTo)< EmailData>其屬性名稱是從第二個(emailIndex)列表URN,EmailFrom,EmailTo動態使用的。
如果添加了4 emailIndex承擔
new IndexNames
{
INDEXDescription = "EmailSubject",
INDEXName = "EmailSubject",
INDEXNumber = 4
}
我應該動態地從名單
我不知道我明白了。你說你有一個EmailData ***的值列表***。那麼你是說在每個EmailData對象內填充URN等? – sr28