Example for explicit interface member implemenation
Type of issue
Other (describe below)
Description
From: Explicit interface member implementations
interface IList<T>
{
T[] GetElements();
}
interface IDictionary<K, V>
{
V this[K key] { get; }
void Add(K key, V value);
}
class List<T> : IList<T>, IDictionary<int, T>
{
T[] IList<T>. GetElements() {...}
T IDictionary<int, T>.this[int index] {...}
void IDictionary<int, T>.Add(int index, T value) {...}
}
Here IDictionary<int,T>.this and IDictionary<int,T>.Add are explicit interface member implementations.
Question: Is IList<T>. GetElements() in T[] IList<T>. GetElements() {...} not an explicit interface member implementation?
Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/interfaces
Content source URL
https://github.com/dotnet/csharpstandard/blob/draft-v8/standard/interfaces.md
Certainly looks that way to me. We'll discuss this in our next meeting in case I've missed something.
Proposed fix: change GetElements to be implicit:
public T[] GetElements() {...}
Agreed in the meeting - I'll create a PR tomorrow.