using System.Collections.Generic;
public static void Main()
var studentA = new Student() { ID = 1, Name = "John Doe", Program = "BCS", Year = 2020, GPA = 2.75F };
var studentB = new Student() { ID = 2, Name = "Jane Doe", Program = "BCS", Year = 2020, GPA = 3.4F };
var studentC = new Student() { ID = 1, Name = "John Jane", Program = "BCS", Year = 2019, GPA = 2.71F };
var AtoB = studentA.Equals(studentB);
var AtoC = studentA.Equals(studentC);
Console.WriteLine("Student A is equal to Student B = {0},AtoB");
Console.WriteLine("Student A is equal to Student C ={0}, AtoC");
public class Student : IEquatable<Student>
public int ID { get; set; }
public string Name { get; set; }
public string Program { get; set; }
public int Year { get; set; }
public float GPA { get; set; }
public bool Equals( Student otherStudent)
return (this.ID == otherStudent.ID);