Cześć,
Troszkę się pogubiłem w konstruktorach, listach i klasach. Chciałem utworzyć konstruktor z 9-cioma polami. Imię, nazwisko,adres....kraj pochodzenia.
Więc go utworzyłem.
public class studentsInformationSheet
{
public string firstName { get; set; }
public string lastName { get; set; }
public DateTime birthdate { get; set; }
public string addressLine1 { get; set; }
public string addressLine2 { get; set; }
public string City { get; set; }
public string stateOrProvince { get; set; }
public string zipOrPostal { get; set; }
public string Country { get; set; }
}
Następnie w Main chciałem przykładowo dodać jeden wpis i go wyświetlić:
List<studentsInformationSheet> studentsInformations = new List<studentsInformationSheet>();
// GetStudentInformation();
studentsInformations.Add("John","Smith","12.12.1222","Zachlapana","5","Warsaw","Mazowieckie","90210","Poland");
foreach(studentsInformationSheet si in studentsInformations){
Console.WriteLine("First Name = {0}, Last Name = {1}", si.firstName, si.lastName);
}
Aczkolwiek napotkałem na błąd:
Error 1 No overload for method 'Add' takes 9 arguments C:\Users\AdolfHitler\Documents\Visual Studio 2013\Projects\ConsoleApplication5\ConsoleApplication5\Program.cs
Za pomoc dziękuję