Documentation Center

  • Trial Software
  • Product Updates

Mutable and Immutable Properties

Setting Property Values

The property SetAccess attribute enables you to determine under what conditions code can modify object property values. There are four levels of set access that provide varying degrees of access to object property values:

  • SetAccess = public — any code with access to an object can set public property values. There are differences between the behavior of handle and value classes with respect to modifying object properties. See Modifying Objects for information on these differences.

  • SetAccess = protected — only code executing from within class methods or methods of subclasses can set property values. You cannot change the value of an object property unless the class or any of its subclasses defines a method to do so.

  • SetAccess = private — only the defining class can set property values. You can change the value of an object property only if the class defines a method to perform this action.

  • SetAccess = immutable — only the class constructor can set property values. You cannot change the value of an object property.

Was this topic helpful?