I am getting accustomed to using the single line ‘If’s.. they are very handy inside the getter-setter. You basically do it like this..
private string m_someVariableName;
Public string SomeVariableName{
get { return someVariableName == null? “my_default_text”: someVariableName; }
set {m_someVariableName = value ; }
}
What if there is a boolean variable? well, you might not even need to check it like this, but I thought maybe we could use something like..
private bool m_someVariableName;
Public bool SomeVariableName{
get { return someVariableName.ToString() == null? true : someVariableName; }
set {m_someVariableName = value ; }
}
and if it is a string [ ] array? I am trying this out, lets see if it works.
private string[ ] m_someVariableName;
Public string [ ] SomeVariableName{
get { return someVariableName.Length==0? “do something” : m_someVariableName ; }
set {m_someVariableName = value ; }
}
If any of you are using similar methods for quicker processing, or if any of these codes helped you, leave me a note!