http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/system-object-a-look-on-mother-of-all-managed-classes/
Normally Student student = new Student();
In this program Student student = new Student { RollNumber = "1" }; I couldn't understand this. Any ones knows please explain.
using System;
namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
Student student = new Student { RollNumber = "1" };
int hash1 = student.GetHashCode();
Console.WriteLine(hash1);
Console.ReadKey(true);
}
}
class Student
{
public string RollNumber { get; set; }
public string Name { get; set; }
public override int GetHashCode()
{
//return base.GetHashCode();
return Convert.ToInt32(RollNumber) * 100;
}
}
}