jeudi 27 avril 2017

Create class when i don't know anything about her

i have problem like this:

In the middle of program i get some class name(as string) and here structure, lets say it can be something like this:

(string) classfullName = myprogram.myclassess.FunnyClass
Properties:
          name=someFirstProperty   Type=System.Int32
          name=someOtherPorperty   Type=System.String

now i would like to create object of this class (i can get here typeof()) but... what should i put in constructor when i don't know how many properties this class would have. i can make that All of the classes which i will operate on would have Constructor with all fields in this case

public FunnyClass(int p1, string p2)

i can make a list of properties of class and FunnyClass would have these 2 properties, but how to make some expression(?) which will call constructors of classes (which i don't know)...?

ps. sorry for my English :)





Aucun commentaire:

Enregistrer un commentaire