Hi all,
I have been trying to figure out but still can't get it.
I don't understand this code snippet :
In the RegisrtationInformation.cs file we implement the struct RegistrationInformation :
Code:
struct RegistrationInformation
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string SelectedEvent {get; set;}
}
Why do we need to add a property to the class _Default in the file Default.aspx.cs ?
Plus I don't get the implementation. Especially the get {.....}
is that an object initialization?
Because concerning the instance creation it should be :
return new RegistrationInformation{....}
Code:
public RegistrationInformation RegistrationInformation
{
get
{
return new RegistrationInformation()
{
FirstName = textFirstName.Text,
LastName = textLastName.Text,
Email = textEmail.Text,
SelectedEvent = dropDownListEvents.SelectedValue
};
}
}
Why does it work? I am missing something. I don't understand
Does anyone have the answer or a good explanation?
That would be much appreciated!
Bon