visual studio - Saving a Set value and using it in get in c# -


i trying simple operation of setting text value , accessing using get().

scenario: working on framework in visual studio.

    private string savevaluename = "";     public string gettext()     {         return savevaluename;     }      public void settext(string output)     {          dynamicvaluesmanager.instance.savevalue(savevaluename, output, true);      } 

my problem: 1. need save value having in settext , use in next step when call gettext().

would suggest using getter/setter in scenario?

private string savevaluename = string.empty; //better practice public string gettext() {     return savevaluename; }  public void settext(string output) {    //save incoming parameter private property:    savevaluename = output //this should called input since passing in parameter no biggie     //not sure function does?     dynamicvaluesmanager.instance.savevalue(savevaluename, output, true);  } //sample code retrieve value passed in:  tempvariable = yourclassname.gettext() 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -