3 ms·
You can't cast a type to an arbitrary interface and hope that it implements the method(s) you want to call in Java or C#.
by apta 7y ago
You can't cast a type to an arbitrary interface and hope that it implements the method(s) you want to call in Java or C#.
- throwaway894345 7y agoThey aren’t “hoping it implements an interface”, they use reflection to determine whether or not the type implements the interface. This is pretty much the same thing in Java or C# with reflection and downcasting, but it’s a bad idea in both languages.