المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Dynamic returns



C# Programming
05-22-2009, 01:21 PM
Hi,
is it possible to have method that returns diffrent datatypes.
this is what i wont todo, used with linq:

.Where castTo("Int32","44") == 44


private ??? castTo(string p_type, string p_value)
{
if(p_type == "Int32") return Convert.Int32(p_value);
if(p_type == "String") return Convert.String(p_value);
}

Thanks