От: | KA | it-knowledge-base.blogspot.com | |
Дата: | 03.01.11 15:10 | ||
Оценка: |
using System.Collections.Generic;
namespace EqualsTest
{
class Super
{
public void Everything() { }
}
class Container<T> : List<T> where T: class
{
public void DoEverything()
{
foreach (T item in this)
item.Everything();
}
}
class Program
{
static void Main(string[] args)
{
Container<Super> con1 = new Container<Super>();
con1.Add(new Super());
con1.DoEverything();
}
}
}
UnknownTest.cs(14,14): error CS1061: 'T' does not contain a definition for 'Everything' and no extension method 'Everything' accepting a first argument of type 'T' could be found (are you missing a using directive or an assembly reference?)