friends i have problem with using get or set in class in c# when i use get or set in gives error(invalid token { in class) pls, see below code,i have this problem in it
The snippet you have posted is fine as it is, also in regards to the error, as it has the correct number of {
to }
and in the right order.
Look at where you have placed it (possibly outside of a class), or look for extra }
in the file.
Update: (following edit in question)
Your issue is here:
public int Speed; // <-- ; should not be here
And:
return _speed // <-- missing the ;
The property should be implemented like this:
public int Speed
{
get
{
return _speed;
}
}