namespace Learncs { interface B { void f();//这样改就行了,接口是不能用public与virtual的,这是语法的规定 } class Program { static void Main(string[] args) { } } }
[解决办法] public问题:
Interfaces can contain methods, properties, events, indexers, or any combination of those four member types. For links to examples, see Related Sections. An interface can't contain constants, fields, operators, instance constructors, destructors, or types. Interface members are automatically public, and they can't include any access modifiers. Members also can't be static.