I have created a class (say Class1) which overrides Equals method as well as "=" and "<>" operators. I have no problems with having statements like "If (X=Y) Then.." etc. where X and Y are defined to be Class1. Now I have created a generic MyDatabase(of T) in which T can be any type that implements the above overloading.
If I define MyDatabase(of T) in which I have a statement "Dim X, Y as T", then the compiler complains whenever it comes across "If (X=Y) Then.." giving an error "Operator "=" is not defined for types 'T' and 'T'".
I tried changing the definition of MyDatabase(of T) to MyDatabase(of T as IEqualityComparer) and MyDatabase(of T as IEqualityComparer(of T)), but am still not getting the compiler to recognize the equality operator of T.
Is there a way to resolve this? Thanks.
Shankar
If I define MyDatabase(of T) in which I have a statement "Dim X, Y as T", then the compiler complains whenever it comes across "If (X=Y) Then.." giving an error "Operator "=" is not defined for types 'T' and 'T'".
I tried changing the definition of MyDatabase(of T) to MyDatabase(of T as IEqualityComparer) and MyDatabase(of T as IEqualityComparer(of T)), but am still not getting the compiler to recognize the equality operator of T.
Is there a way to resolve this? Thanks.
Shankar