I learning about writing my own interfaces and came across the MSDN article "Interfaces (C# Programming Guide)". Everything seems fine, except: what does <T> mean or do?
interface IEquatable<T>
{
bool Equals(T obj);
}
It means that it is a generic interface.
You could create an interface like this:
public interface IMyInterface<T>
{
T TheThing {get; set;}
}
and you could implement it in various ways:
public class MyStringClass : IMyInterface<string>
{
public string TheThing {get; set;}
}
and like this:
public class MyIntClass : IMyInterface<int>
{
public int TheThing {get; set;}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With