+ 1

I get error when i try to use get and set funtion in microsoft visual studio 2017, what should i do?

15th Jun 2017, 1:54 PM
Jayesh Bhushan
Jayesh Bhushan - avatar
5 Réponses
+ 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.
15th Jun 2017, 7:13 PM
sneeze
sneeze - avatar
0
count brackets, post the code, post the error text, google the error text.
15th Jun 2017, 2:10 PM
sneeze
sneeze - avatar
0
class movie { private string Name="abc"; public string getname() { get{return Name;} } }
15th Jun 2017, 2:17 PM
Jayesh Bhushan
Jayesh Bhushan - avatar
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;} } }
15th Jun 2017, 2:27 PM
sneeze
sneeze - avatar
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.
15th Jun 2017, 2:39 PM
Jayesh Bhushan
Jayesh Bhushan - avatar