lundi 7 mars 2016

convert String Type to int,float,decimal etc Type on runtime C#

I have made a program in which i wanted to convert all values depending on parameters type which is get by run time methods, what i want is convert all values which are enter by user in textbox in define type of parameter. what i wanted is

private object convertType(Type type, string value)
    {
        Type t = typeof(int);
        //suppose value have stringvalue=33;
        return 33; //of type int
    }

is there any way to get any object type ?





Aucun commentaire:

Enregistrer un commentaire