N
Nie longhai
I have a generic method in a class as follow:
T Get<T>(string key)
{
.....
return Convert.ChangeType(v, typeof(T))
}
when I use it in my code:
string ret = MyObject.Get("key");
compile failed , type inference cann't work, why?
thanks for any advice!
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Nie Longhai, Coder ^_*
Shanghai Xomi Instruments Co.,Ltd.
Phone: 086-021-57513966(807)
Fax: 086-021-57513966
Cell: 13162055440
Email: (e-mail address removed), (e-mail address removed)
Web: www.xomi.cn
Zip: 201411
Shanghai C&U Industrial Park
Feng Cheng Town, Feng Xian District
T Get<T>(string key)
{
.....
return Convert.ChangeType(v, typeof(T))
}
when I use it in my code:
string ret = MyObject.Get("key");
compile failed , type inference cann't work, why?
thanks for any advice!
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Nie Longhai, Coder ^_*
Shanghai Xomi Instruments Co.,Ltd.
Phone: 086-021-57513966(807)
Fax: 086-021-57513966
Cell: 13162055440
Email: (e-mail address removed), (e-mail address removed)
Web: www.xomi.cn
Zip: 201411
Shanghai C&U Industrial Park
Feng Cheng Town, Feng Xian District