Constructor parameter list

A

Andrus

I have linq entity type with public constuctor having all properties as
parameters like

class MyEntity: IModified {

protected string _a_a;

[Column(Name = ""a_a"", DbType = ""character"")]
public string A_a {
get { return _a_a; }
set { _a_a = value; _isModified_ = true; }
}

public MyEntity( a_a string ) {
_a_a = a_a;
}

}

I need to get constructor parameter list at runtime for dynamic assembly
generation, something like

string GetConstructor( Type t )

GetConstructor(typeof(MyEntity)) should return

"a_a string"

Any sample code which implements this ?

Andrus.
 
J

Jon Skeet [C# MVP]

I need to get constructor parameter list at runtime for dynamic assembly
generation, something like

string GetConstructor( Type t )

GetConstructor(typeof(MyEntity)) should return

"a_a string"

Any sample code which implements this ?

Just call Type.GetConstructors - although that will only return public
constructors unless you specify a BindingFlags argument.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top