By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

How Can I Get a "Auto Type Convert" in C# ?

P: n/a

Hi, all

I want to know is there any way to perfermen "AutoTypeConvert"

eg.

string nama = "Key";

float fVal = Get(name);
int iVal = Get(name);
Set(name, fVal);
Set(name, iVal);

in C# , method cann't overloaded by return type, so "Get(name)" compile
failed
I try it using Generic Method & implicit type check:

T Get(string name);
void Set(string name, T val);

but Compiler cann't work when using a Property

Can anyone give me some advice?

thanks
--

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Nie Longhai, Coder ^_*

Shanghai Xomi Instruments Co.,Ltd.

Phone: 086-021-57513966(807)
Fax: 086-021-57513966
Cell: 13162055440
Email: ni***@xomi.cn, co****@163.com
Web: www.xomi.cn
Zip: 201411

Shanghai C&U Industrial Park
Feng Cheng Town, Feng Xian District
Sep 27 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.