Interface: Why can i use a property but not a field? [duplicate]
Possible Duplicate:
Why can't C# interfaces contain fields?
Why can i use a property but not a field in an interface? I don't understand what would be different in the backend (sure one is more like a method but why does that matter) or any reasoning to exclude fields from interfaces.
Interfaces consist of methods, properties, events, indexers, or any combination of those four member types. An interface cannot contain constants, fields, operators, instance constructors, destructors, or types. It cannot contain static members. Interfaces members are automatically public, and they cannot include any access modifiers.
An interface has the following properties:
An interface is like an abstract base class: any non-abstract type that implements the interface must implement all its members.
An interface cannot be instantiated directly.
Interfaces can contain events, indexers, methods, and properties.
Interfaces contain no implementation of methods.
Classes and structs can implement more than one interface.
An interface itself can inherit from multiple interfaces.
精彩评论