How to dynamically create a C# Class. I have 3 method informations. I have to create a dynamic C# class and it should consist of those 3 methods. Any ideas?..
1 Answer
if saying class, you need just to have a type with this 3 methods, you can use DynamicObject.
This is special type of objects in C#, that permits runtime add/remove of members to an instance of that type.
4 Comments
senthil kumar
Can u please give me some exaples?
Ergwun
@senthilkumar Here's an example of how to use DynamicObject: msdn.microsoft.com/en-us/library/ee461504.aspx
senthil kumar
Can u please explain with some example. Like, my dynamic class name (Type) should be Test and the method details are.. Method 1: public int add(int a, int b) {....} Method 2: public void display(string str){....} Method 3 public string SayHello(string name){....}
Tigran
@senthilkumar: that was actually a point in my asnwer. If you need some precise type, so named type, you should follow the link of the answer that was deleted (don't know why) were you create a new type. Here is it: stackoverflow.com/questions/3862226/…