[C#] 轉型, DictionaryEntry -> Hashtable

Hashtable xx = o.outlookMessages;
//o.outlookMessages是個Hashtable


foreach (DictionaryEntry de in xx)
{
//de是個DictionaryEntry object~但實際上是一個Hashtable~要輸出裡面的資料~要透過轉型
Hashtable ttt = (Hashtable)de.Value;
Response.Write(de.Key);
Response.Write(ttt["From"]);
Response.Write(ttt["To"]);
Response.Write(ttt["Subject"]);
}

沒有留言: