get and set accessibility - CSharp Custom Type

CSharp examples for Custom Type:Property

Introduction

The get and set accessors can have different access levels.

public class Foo
{
 private decimal x;
 public decimal X
 {
   get         { return x;  }
   private set { x = Math.Round (value, 2); }
 }
}

Related Tutorials