Answers for "get set unity"

C#
4

get and set unity

class Thing {
  private int secret; // This is a field.

  public int Secret { // This is a property.
    get {
      Debug.Print("Somebody is accessing the secret!");
      return secret;
    }

    set {
      Debug.Print("Somebody is writing to the secret!");
      secret = value; // Note the use of the implicit variable "value" here.
    }
  }
}
Posted by: Guest on November-04-2020
5

get set c#

private string name;
public string Name
{
    get
    {
        return this.name;
    }
    set
    {
        this.name = value;
    }
}
Posted by: Guest on June-15-2020

C# Answers by Framework

Browse Popular Code Answers by Language