jeudi 7 avril 2016

Type casting using string of type

I have fully qualified class name which I have to use for type casting. I can get type using

someType=Type.GetType("TypeName"). 

After Deserializing I am getting object which I have to typecast into particular type i.e TypeName.

I tried

obj = (someType) SXmlSerializer.Deserialize("TypeName", someData);

but that doesn't works . Is there any option available to do typecasting using only class name as string?





Aucun commentaire:

Enregistrer un commentaire