Interface IReadOnly
Defines read-only handling for objects
Namespace: EPiServer.Data.Entity
Assembly: EPiServer.Data.dll
Version: 9.12.2Syntax
public interface IReadOnly
Remarks
Primarily intended to change read-write objects into immutable (read-only) objects to be able to safely use the same object in several different threads, etc.
Properties
IsReadOnly
Indicates whether the current object instance is read-only.
Declaration
bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
CreateWritableClone()
Creates a writable copy of the current object.
Declaration
object CreateWritableClone()
Returns
Type | Description |
---|---|
System.Object | A writable copy of the current object. |
Remarks
The cloning is a deep-copy.
MakeReadOnly()
Changes the object instance into a read-only object.
Declaration
void MakeReadOnly()
Remarks
After calling this method, any attempt to change the object instance or any contained object will generate a System.NotSupportedException. I.e. the semantics is "deep read-only".
Note! After setting an object to read-only it is not possible to revert back to read-write mode. You will have to call the CreateWritableClone method to get a copy that can be modified.