1

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 1

3

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Can u please give me some exaples?
@senthilkumar Here's an example of how to use DynamicObject: msdn.microsoft.com/en-us/library/ee461504.aspx
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){....}
@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/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.