Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use run time class generation with generics

Status
Not open for further replies.

123qweasdzc

Programmer
Joined
Sep 27, 2005
Messages
20
Location
PT
Hello :).

I am creating run time classes using System.Reflection.Emit:
AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("DataBuilder.exe"), AssemblyBuilderAccess.Save, AppDomain.CurrentDomain.Evidence);
ModuleBuilder mb = ab.DefineDynamicModule(ab.FullName, "DataBuilder.exe", false);
TypeBuilder tb = mb.DefineType("SerializeClass", TypeAttributes.Public , typeof(object));
...

Then I have a class:
public class ProcessData<T> where T : class
{
....
}

I want to use the type I built as T:
ProcessData<TypeIBuild> processData = new ProcessData<TypeIBuild>();

Is it possible? How?

Thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top