C#C
C#3mo ago
Ruttie

Check that two function signatures are equal at compile-time

I have two C# methods, which we'll call method A and B.
I know the exact signature of A, but not of B.
I want to write some C# code that, at compile time, ensures that A and B have the same signature.
However, the equality should be somewhat loose, for example if B is an instance method with no parameters and no return value, and A is a method with as sole parameter the class B resides in and no return value, they should be equal.
Is this possible?
Was this page helpful?