Note that there are some explanatory texts on larger screens.

plurals
  1. POIEnumerable.GetEnumerator() and IEnumerable<T>.GetEnumerator()
    text
    copied!<p>In the .net framework, there's a generic <code>IEnumerable&lt;T&gt;</code> interface which inherits from the not-generic <code>IEnumerable</code>, and they both have a <code>GetEnumerator()</code> method. The only differents between these two <code>GetEnumerator()</code> is the return type. Now I have a similar design, but when I compile the code, the compiler said:</p> <p><strong><code>MyInterface&lt;T&gt;.GetItem()</code>' hides inherited member '<code>MyInterface.GetItem()</code>'. Use the new keyword if hiding was intended.</strong></p> <p>The <code>MyInterface&lt;T&gt;.GetItem()</code> returns a concrete type T, while <code>MyInterface.GetItem()</code> returns type System.Object.</p> <p>So I think if the BCL team guys compile the .net framework, they will get the same warning. </p> <p>I think having compiler warnings is not good, what do you think? And how can I solve this problem? I mean I want to get the concrete type T when calling the <code>MyInterface&lt;T&gt;.GetItem()</code> not just a instance of type System.Object.</p> <p>Thanks in advance! :-)</p> <p><strong>Supplement:</strong> I'm saying the interfaces theirselves: IMyInterface <strong>inherits from</strong> IMyInterface, and they both have the GetItem() method (the IMyInterface.GetItem() returns type T, while IMyInterface.GetItem() returns type System.Object). The problem is that, if <strong>our code only have these two interfaces</strong>, that is, no derived concrete classes, we will encounter the compiler warning after compile the source code.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload