Can anybody tell me why can't i create Get Set properties using this syntax?
public class Customer
{
public int ID { get; set; }
public string Name { get; set; }
}
Brackets after get and set won't help either.
it gives: "ReadOnlyProperty.Customer.ID.get' must declare a body because it is not marked abstract or extern"
Marking them abstract or extern won't help either.
I know that this would do the job:
public int ID
{
get
{
return m_id;
}
set
{
m_id = value;
}
}
public string Name
{
get
{
return m_name;
}
set
{
m_name = value;
}
}
I read from the book that the first one is possible to implement.
Am i missing something?
Thanks in advance,
and don't forget... C sharp, think sharp

New Topic/Question
Reply




MultiQuote



|