日期:2014-05-18  浏览次数:20982 次

取出object里的键值
原KeyValuePair<int,string>类型的数据,在传值的过程中变成了Object.
请问现在我该如果把它变回KeyValuePair?

------解决方案--------------------
C# code
KeyValuePair<int,string> pair = (KeyValuePair<int,string>)obj;

------解决方案--------------------
(KeyValuePair)obj
或者
obj as KeyValuePair
------解决方案--------------------
KeyValuePair<int,string> pair = (KeyValuePair<int,string>)obj;
或者
KeyValuePair<int,string> pair = obj as KeyValuePair<int,string>;
------解决方案--------------------
探讨

C# code
KeyValuePair<int,string> pair = (KeyValuePair<int,string>)obj;