Hi i have code that shows an error "Error: simplegetset Compile Error: Variable is not visible: userinput at line 14 column 15".I just want to know is this not right way to define get and set here is the code.
public class simplegetset
{
// public String userinput{get; set;}
public string userinput{set;}
//public string userinput{get;}
/* public void setUserinput(string userinput)
{
this.userinput = userinput;
} */
public void getUserinput()
{
return userinput;
}
}
And same if I declare getter setter like this and when I write like this
public class simplegetset {
public string userinput{get;} public string userinput{get;}
public void setUserinput(string userinput){
this.userinput = userinput;
}
}
Its shown an same error "Variable is not visible" is this not right way to declare getter and setter?
{get;set;}
syntax or use thegetVarName
syntax - not a bit of both.