As one who comes from a C++ background, I've come across the following situation:
Given that c# does not support typedefs, how do you programmatically relate types. That is to say in C++ I can store related types as typedefs for retrieval when used with templates. The same thing cannot be done in c# in the same way because of the lack of typedef.
For example in C++ I would:
template< typename T > class Thing : public ThingBase<T> { public: bool isRelated( T::Parent & otherThing ) { T::Auxillary aux( "Yes" ); return aux.isValid( otherThing ) && data.isParent( otherThing ); } private: T data; }; That would work with either of the following:
class SomeClass { public: typedef SomeClassParent Parent; typedef FooAuxillary Auxillary; bool isParent( Parent & parentObject ); }; class OtherClass { public: typedef OtherClassParent Parent; typedef BarAuxillary Auxillary; bool isParent( Parent & parentObject ); }; While the being able to call T::isParent on the parameter type could be achieved with a common interface interface, building the signature for Thing::isRelated seems like it would be impossible without typedefs.
So, in C# what do I do to get the related interface type for T (which is T::Interface in the C++ example)?