c# interface methods code example
Example 1: c# interface properties
public interface ISampleInterface
{
// Property declaration:
string Name
{
get;
set;
}
}
Example 2: c# interfaces
public class Car : IEquatable<Car>
{
public string Make {get; set;}
public string Model { get; set; }
public string Year { get; set; }
// Implementation of IEquatable<T> interface
public bool Equals(Car car)
{
return (this.Make, this.Model, this.Year) ==
(car.Make, car.Model, car.Year);
}
}