public class StudentNames : INotifyPropertyChanged
{
string firstname
string surname
public string FirstName
{
get
{
return firstname;
}
set
{
if (firstname != value)
{
firstname = value;
OnPropertyChanged("FirstName");
}
}
}
public string Surname
{
get
{
return surname
}
set
{
if (surname != value)
{
surname = value;
OnPropertyChanged("Surname");
}
}
}
}
public class StudentDetails : INotifyPropertyChanged
{
string address StudentNames sn
public string SN
{
get
{
return sn;
}
set
{
if (sn != value)
{
sn = value;
OnPropertyChanged("SN");
}
}
}
public string Address
{
get
{
return address;
}
set
{
if (address != value)
{
address = value;
OnPropertyChanged("Address");
}
}
}
}
elsewhere I have the logic:
StudentDetails sd = new StudentDetails()
sd.StudentNames.FirstName = "John"//this part gives me a runtime error
It compiles but I get a runtime error :
"Object reference not set to an instance of an object."