C#C
C#4y ago
Star

How to override virtual interface in an interface

So I know a virtual method has a base implementation for interfaces, but I want to override that in a second interface that implements that interface, as fallows.
    public interface INeed<T> : INeed {
        void /*.*/ Receive(
            T value);

        override virtual Type TypeNeeded() {
            return typeof(T);
        }
    }
    
    public interface INeed {
        virtual Type TypeNeeded() {
            return null;
        }
    }

The above gives me an error, and if I get rid of override it requires a new keyword. I could just leave it to what ever inherits it, but the functionality is very straight forward, and just need it sepperated from the generic class so I can use it in a more generic way.
Was this page helpful?