Frank Michael Kraft
Frank Michael Kraft

Reputation: 2362

Framework for .net Reflection.Emit simplification?

Is there a framework, that makes the use of of Reflection.Emit easier? Something I can tell: Give me a class with a string field and get,set accessors.

The code I find in Create a class type in code in .net c# is what I need, but it is somewhat cryptic. I think a library with a simplified interface would boost productivity.

Upvotes: 7

Views: 304

Answers (2)

leppie
leppie

Reputation: 117250

Have a look at the CCI.

Upvotes: 3

Marc Gravell
Marc Gravell

Reputation: 1062975

I think you just described CodeDOM. Unfortunately, it doesn't really (IMO) make it easier - it just makes it... different.

Personally, I'd just use TypeBuilder, ILGenerator and encapsulate the common functionality I need, i.e.

PropertyBuilder CreateProperty(TypeBuilder type, string name, Type propertyType)
{...}

Meta-programming is rarely simple, but from that detail you get a very good understanding of what is actually happening.

Upvotes: 4

Related Questions