public void Display() { SIM = SIM.Where(x => x != null).OrderBy(x => x.name).ToArray(); Phone = Phone.Where(x => x != null).OrderBy(x => x.name).ToArray(); Console.WriteLine("----------Printing Contacts from SIM----------"); for (int i = 0; i < getCount(SIM); i++) { Contacts contactObject = SIM[i]; Console.WriteLine("{0}. Name: {1}, Mobile Number: {2}, Email Id: {3}", i + 1, contactObject.name, contactObject.mobileNumber, contactObject.emailId); } Console.WriteLine(); Console.WriteLine("----------Printing Contacts from Phone----------"); for (int i = 0; i < getCount(Phone); i++) { Contacts contactObject = Phone[i]; Console.WriteLine("{0}. Name: {1}, Mobile Number: {2}, Email Id: {3}", i + 1, contactObject.name, contactObject.mobileNumber, contactObject.emailId); } }