Every .net developer knows about the concept of properties. A rough 99.99%, it's just a piece of metadata gluing together two methods, a getter, and a setter.
Same thing usually goes for events, with their add, remove, and invoke method.
The ECMA-335 describes a «Other» kind of method semantic, that would apply to either a property or an event. Conceptually, a property or an event could have a multiple number of «other» methods.
Today's the first day I stumbled upon a property with an «other» method. And of course it had to be related to COM. The interface EnvDTE.Property, in the EnvDTE assembly (used to write addins to Visual Studio), contains a property defined as follows:
.property object Value()
{
.custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 00 00 00 00 00 00 )
.get instance object EnvDTE.Property::get_Value()
.other instance void EnvDTE.Property::let_Value(object)
.set instance void EnvDTE.Property::set_Value(object)
}
With let_Value being defined as:
.method public hidebysig newslot specialname abstract virtual
instance void let_Value([in] object marshal( struct) lppvReturn) runtime managed internalcall
{
.custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 00 00 00 00 00 00 )
}
Apparently, VBScript and versions of VB before VB.NET can define properties using a Let keyword. And the Let has a same signature as the Set. I sense that there's a relationship here.
But does anyone know how this property have been declared in the language that EnvDTE has been written with? How could I create an assembly with the same pattern (without using ilasm, that would be too easy)? And does anyone have faced a similar property?
And does anyone have seen other «other» properties, with maybe a different semantic than this one? And if yes, what are they used to?