This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
notes:csharp:interfaces [2017/02/09] admin [Explicit Interface Implementation] |
notes:csharp:interfaces [2017/02/09] (current) admin [Explicit Interface Implementation] |
||
---|---|---|---|
Line 93: | Line 93: | ||
- | Example: We have two methods that have the same signature and different return types. This is how it may be solved using explicit interface implementation: | + | Example: We have two methods that have the same signatures and different return types. It won't compile as the method overloading does not take into account return types. This is how it may be solved using explicit interface implementation: |
<code csharp> | <code csharp> | ||
public class EnumerableCatalog : IEnumerable<string> | public class EnumerableCatalog : IEnumerable<string> | ||
Line 107: | Line 107: | ||
IEnumerator IEnumerable.GetEnumerator() | IEnumerator IEnumerable.GetEnumerator() | ||
{ | { | ||
- | ... | + | return this.GetEnumerator(); |
} | } | ||
} | } |