Hi Marc,
Thank you again for replying.
I am sorry for changing the name of the interface by mistake, but let's
continue with the IListen<>.
As far as I can see, your suggestion is exactly what I have tried to
communicate with the
"My IListen<T> has a base (IListenBase), but that is just to speed up
the detection. It does not solve anything. "
part of the previous post.
I have an empty IListenBase as a base for the generic interface. Bu
that does not change anything. This is because of two things:
A) knowing that a class implements the IListenBase, does not tell me
what kind of IListen<> it implements. It does not get me any closer to
the solution. As i wrote it speeds up the detection, as i can write
"if(component is IListenBase)" and know if i am getting close, but it
does not tell me anything more.
B) There is no guard against some looney programmer might implement the
IListenBase, but not any actual IListen<> interface.
What I really need is some finer grained distinction in the C#
language/.Net platform, that can says:
"Yes, this object implements IListen<>' and "The argument to IListen<>
is Rates".
I realize that IListen<Customer> and IListen<Rates> are two different
interfaces. But i am baffled by the fact that there seems to be no
simple way to test for the fact that there is a common denominator in
the IListen<> generic interface.
If i say "Find all references" in Visual Studio 2005 on the name of the
generic interface, it finds all my implementations of IListen<>, no
matter what i have given as the generic argument.
I of course know that VS 2005 and the .Net platform is not the same,
but i am refering to the idea. Visual Studio is aware of the connection
between IListen<>, IListen<Rates> and IListen<Customers>, where as the
C# language doesn't have any way of expressing that.
I am experimenting with the reflection part, looping through all the 32
interfaces my user controls are implementing, checking by string
comparison if any of the interfaces might contain some magic strings,
but that is slow and very inelegant.
Sigh.
Thank you for taking the time to answer,
Kasper