I'm trying to understand some specifics about C#'s generics.
If I have a method defined as such
public static void AssertContains<T>(IEquatable<T> val, List<IEquatable<T>> optionsObjs, XML xml, string context)
and a class that implements IEquatable
,
public class Tag : IEquatable<Tag>
{
public string id;
public bool Equals(Tag other)
{
return other.id == this.id;
}
}
why is the following invalid?
AssertContains(aTag, aListOfTags, el, "");