glitteringsound wrote:
e.g I have read data from an XML file i.e BSTR field1,BSTR field2,BSTR field3,BSTR field4,BSTR field5,long field6
I don't think creating types at runtime is the correct way to do this. You should try to design your types in such a way that it can hold the data coming from XML file. For the example you have shown, I'd create a class which has a List which can hold all BSTR fields. If datatype of BSTR fields are not primitive, I'd create a separate type for BSTR and keep it in the above said list. Now if you have different data types for fields, you can keep a datatype identifier field which will tell you what type the value should be. This will help you to cast to the correct value before using. :)
Best wishes, Navaneeth