> rather than an override. Unfortunately I don't think there's much you
> can do about it since this flag isn't exposed by Reflection.
Richard,
>(although I'd love to know how you got the IlDasm-style view of it?).
I simply saved the dynamic assembly and opened it in Ildasm :)
>That was a little surprising though. It's a shame I can't generate code
>that will make the class behave like the compiled one. :-(
I noticed that you can get rid of the error by not overriding the
property at all, and only override the get_SimpleProperty method. I'm
not sure if that's recommended or if it gives some nasty side effect,
but at least Peverify doesn't complain.
>Does this mean
>the compiler writers use a different API? (CodeDom?)
Most compilers use the native COM API; ICeeFileGen,
IMetaDataAssemblyEmit and IMetaDataEmit.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Richard Brown - 02 Jul 2007 13:36 GMT
Mattias,
> I simply saved the dynamic assembly and opened it in Ildasm :)
Doh! :-) OK, I see how to do that now. Thanks.
> I noticed that you can get rid of the error by not overriding the
> property at all, and only override the get_SimpleProperty method. I'm
> not sure if that's recommended or if it gives some nasty side effect,
> but at least Peverify doesn't complain.
I had noticed this too - unfortunately, line 90 of the original example then
fails due to the Reflection with BindingFlags.DeclaredOnly not returning the
overridden property.
> Most compilers use the native COM API; ICeeFileGen,
> IMetaDataAssemblyEmit and IMetaDataEmit.
It looks the Reflection Emit namespace can't really do what I was after.
However, thank you very much for getting me this far. Your help is very
much appreciated.
Cheers,
Richard