When I disassemble a .NET assembly, reflector will always show the poperty accessors in the order { get; set; }. For .NET this is OK, as it binds by signature.
For COM however, the actual position in the vtable is important. So, there's a big difference between { get; set; } and { set; get; }. I ran into this when I tried to use reflector to selectively take some interface definitions from the Microsoft.mshtml.dll PIA. The definitions in mshtml.idl all have their property put before the property get (and using the generated interface definitions resulted in access violations -- sets have a different level of indirection for their parameters than gets).
So, I would suggest to not blindly emit a { get; set; } when encountering a property in metadata, but rather delve into the actual accessor methods and find the real vtable order ... More work, but very rewarding (at least to me :-)).
Many thanks,
-- Henkk
For COM however, the actual position in the vtable is important. So, there's a big difference between { get; set; } and { set; get; }. I ran into this when I tried to use reflector to selectively take some interface definitions from the Microsoft.mshtml.dll PIA. The definitions in mshtml.idl all have their property put before the property get (and using the generated interface definitions resulted in access violations -- sets have a different level of indirection for their parameters than gets).
So, I would suggest to not blindly emit a { get; set; } when encountering a property in metadata, but rather delve into the actual accessor methods and find the real vtable order ... More work, but very rewarding (at least to me :-)).
Many thanks,
-- Henkk