lundi 14 novembre 2016

How to make a property with a if-statement

my question is, if it's possible, to do something like this:

public Class Test
{
  public int Number { get; set; }
  private string text;

  public string Text
  {
    if (Number > 5)
    {
      set {text = value;}
      get {return text;}
    }
  }
}

I hope, you can help me Ahrtaler

Aucun commentaire:

Enregistrer un commentaire