+ 1
I get error when i try to use get and set funtion in microsoft visual studio 2017, what should i do?
5 Antworten
+ 1
https://code.sololearn.com/cCC8YR1d25T6/?ref=app
have a look at this code.
I don't think get is problem
the problem is that "name" is a keyword.
0
count brackets, post the code, post the error text, google the error text.
0
class movie
{
private string Name="abc";
public string getname()
{
get{return Name;}
}
}
0
do not use getname method it is not a getter.
get and set are special methods that do not follow the standard rules.
class movie
{
private string name="abc";
public string Name
{
get{return name;}
set {name = value;}
}
}
0
thanks but but I still get the error.It goes like this "The name 'get' does not exists in the current context.Maybe i need to download some additional
extension file for visual studio.