dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pnet-developers] a problem with a constructor


From: Mari R
Subject: [Pnet-developers] a problem with a constructor
Date: Sun, 25 Sep 2005 14:38:44 -0700 (PDT)

I'm trying to create a dynamic proxy. I have define a
typebuilder :

AppDomain myDomain = Thread.GetDomain();
AssemblyName assemblyName = new AssemblyName();
assemblyName.Name = "Intercep";

asmBuilder = myDomain.DefineDynamicAssembly(
assemblyName,AssemblyBuilderAccess.RunAndSave);

modBuilder =
asmBuilder.DefineDynamicModule(asmBuilder.GetName().Name,
false);

typeBuilder = modBuilder.DefineType
(asmBuilder.GetName().Name + ".__Proxy" +
interfaceType.Name + targetType.Name,
TypeAttributes.Class | TypeAttributes.Public,
targetType.BaseType, new Type [] {interfaceType,
typeof EmitedInfo)});


fbTarget = typeBuilder.DefineField ("target",
typeof(object), FieldAttributes.Private);

fbIface = typeBuilder.DefineField ("iface", typeof
(Type), FieldAttributes.Private);

Type[] types =new Type [2];
types[0] = typeof(object);
types[1] = typeof(Type);

ConstructorBuilder Ctor =
typeBuilder.DefineConstructor(MethodAttributes.Public,CallingConventions.Standard,
types);

And then when i try this

type= typeBuilder.CreateType();

an invalid operation exception

I would appreciate any kind of help, thank you very much.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]