interface as return type
问题 Can interface be a return type of a function. If yes then whats the advantage. e.g. is the following code correct where array of interface is being returned. public interface Interface { int Type { get; } string Name { get; } } public override Interface[] ShowValue(int a) { . . } 回答1: Yes, you can return an interface. Let's say classes A and B each implement interface Ic : public interface Ic { int Type { get; } string Name { get; } } public class A : Ic { . . . } public class B : Ic . . . }