Επεξεργασία

Κοινή χρήση μέσω


Freezable.Freeze Method

Definition

Makes a Freezable object unmodifiable and sets its IsFrozen property to true, or tests whether a Freezable object can be made unmodifiable.

Overloads

Freeze()

Makes the current object unmodifiable and sets its IsFrozen property to true.

Freeze(Freezable, Boolean)

If the isChecking parameter is true, this method indicates whether the specified Freezable can be made unmodifiable. If the isChecking parameter is false, this method attempts to make the specified Freezable unmodifiable and indicates whether the operation succeeded.

Freeze()

Makes the current object unmodifiable and sets its IsFrozen property to true.

public:
 void Freeze();
public void Freeze ();
member this.Freeze : unit -> unit
Public Sub Freeze ()

Exceptions

The Freezable cannot be made unmodifiable.

Remarks

To avoid the possibility of an InvalidOperationException when calling this method, check the CanFreeze property to determine whether the Freezable can be made unmodifiable before calling this method.

Notes to Inheritors

This method uses the FreezeCore(Boolean) method to make the Freezable unmodifiable. To modify freezing behavior, override the FreezeCore(Boolean) method.

See also

Applies to

Freeze(Freezable, Boolean)

If the isChecking parameter is true, this method indicates whether the specified Freezable can be made unmodifiable. If the isChecking parameter is false, this method attempts to make the specified Freezable unmodifiable and indicates whether the operation succeeded.

protected public:
 static bool Freeze(System::Windows::Freezable ^ freezable, bool isChecking);
protected internal static bool Freeze (System.Windows.Freezable freezable, bool isChecking);
static member Freeze : System.Windows.Freezable * bool -> bool
Protected Friend Shared Function Freeze (freezable As Freezable, isChecking As Boolean) As Boolean

Parameters

freezable
Freezable

The object to check or make unmodifiable. If isChecking is true, the object is checked to determine whether it can be made unmodifiable. If isChecking is false, the object is made unmodifiable, if possible.

isChecking
Boolean

true to return an indication of whether the object can be frozen (without actually freezing it); false to actually freeze the object.

Returns

If isChecking is true, this method returns true if the specified Freezable can be made unmodifiable, or false if it cannot be made unmodifiable. If isChecking is false, this method returns true if the specified Freezable is now unmodifiable, or false if it cannot be made unmodifiable.

Exceptions

When isChecking is false, the attempt to make freezable unmodifiable was unsuccessful; the object is now in an unknown state (it might be partially frozen).

Remarks

Do not call this method unless you are deriving from Freezable and overriding the FreezeCore method. This method may be used in the FreezeCore method to freeze class data members that are themselves Freezable objects.

It is alright to call this method again on a Freezable object that is already frozen (unmodifiable).

Notes to Inheritors

This method uses the FreezeCore(Boolean) method to make the Freezable unmodifiable. To modify freezing behavior, override the FreezeCore(Boolean) method.

See also

Applies to