Hello Patrick,
I seem to get my properties defined with the instance keyword (though I dont
know what it leans in IL).
I do:
Dim tFieldBuilder As FieldBuilder = Nothing
Dim tPropertyBuilder As PropertyBuilder = Nothing
Dim tMethodBuilder As MethodBuilder = Nothing
tFieldBuilder = tTypeBuilder.DefineField("sSomeString", tType, FieldAttributes.Private)
tPropertyBuilder = tTypeBuilder.DefineProperty("SomeString", System.Reflection.PropertyAttributes.None,
tType, Nothing)
tMethodBuilder = tTypeBuilder.DefineMethod("get_SomeString", MethodAttributes.Public
Or MethodAttributes.SpecialName, tPropertyBuilder.PropertyType, New Type()
{})
tILGenerator = tMethodBuilder.GetILGenerator
With tILGenerator
.DeclareLocal(tPropertyBuilder.PropertyType)
.Emit(OpCodes.Nop)
.Emit(OpCodes.Ldarg_0)
.Emit(OpCodes.Ldfld, tFieldBuilder)
.Emit(OpCodes.Stloc_0)
.Emit(OpCodes.Ldloc_0)
.Emit(OpCodes.Ret)
End With
tPropertyBuilder.SetGetMethod(tMethodBuilder)
> Is it possible to Define a property with the TypeBuilder and having
> the IL code definition use the instance keyword... seems like code
[quoted text clipped - 6 lines]
>
> Thanks
Patrick - 07 Jun 2006 14:21 GMT
Ok found out it was my DefineProperty that was wrong... i tought that the
ParameterTypes parameter was the "value" parameter (== to return type) ...now
i pass null and everything is back to normal.
Thanks
> Hello Patrick,
> I seem to get my properties defined with the instance keyword (though I dont
[quoted text clipped - 34 lines]
> >
> > Thanks
Patrick - 07 Jun 2006 15:43 GMT
Ok what I am doing is overriding a Property... its seems to work but when i
call GetProperties on my new type that overrides the property... i get two
distinct propertyInfos... and thats not what i want since one inherits the
attributes and the other doesnt... what do i need to do to define a overriden
property???
> Ok found out it was my DefineProperty that was wrong... i tought that the
> ParameterTypes parameter was the "value" parameter (== to return type) ...now
[quoted text clipped - 40 lines]
> > >
> > > Thanks