Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Shared / MS / Internal / FreezableOperations.cs / 1305600 / FreezableOperations.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: FreezableOperations class definition. // // History: // 2005/02/02 : [....] - Created // //--------------------------------------------------------------------------- using System; using System.Windows; using MS.Internal.PresentationCore; namespace MS.Internal { ////// Internal static class which provides helper methods for common /// Freezable operations. /// [FriendAccessAllowed] // Built into Core, also used by Framework. internal static class FreezableOperations { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- //------------------------------------------------------ // // Internal Methods // //----------------------------------------------------- #region Internal Methods ////// A null-safe wrapper around Freezable.Clone(). (If a null /// is encountered it returns null.) /// internal static Freezable Clone(Freezable freezable) { if (freezable == null) { return null; } return freezable.Clone(); } ////// Semantically equivilent to Freezable.Clone().Freeze() except that /// GetAsFrozen avoids copying any portions of the Freezable graph /// which are already frozen. /// public static Freezable GetAsFrozen(Freezable freezable) { if (freezable == null) { return null; } return freezable.GetAsFrozen(); } ////// If freezable is already frozen, it returns freezable /// If freezable is not frozen, it returns a copy that is frozen if possible /// internal static Freezable GetAsFrozenIfPossible(Freezable freezable) { if (freezable == null) { return null; } if (freezable.CanFreeze) { freezable = freezable.GetAsFrozen(); } return freezable; } ////// Moves the specified changed handler from the old value /// to the new value correctly no-oping nulls. This is useful /// for non-Freezables which expose a Freezable property. /// internal static void PropagateChangedHandlers( Freezable oldValue, Freezable newValue, EventHandler changedHandler) { if (newValue != null && !newValue.IsFrozen) { newValue.Changed += changedHandler; } if (oldValue != null && !oldValue.IsFrozen) { oldValue.Changed -= changedHandler; } } #endregion Internal Methods } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PropertyChangedEventManager.cs
- TextEffect.cs
- SafeLibraryHandle.cs
- IDispatchConstantAttribute.cs
- designeractionlistschangedeventargs.cs
- SafeCoTaskMem.cs
- FormatSettings.cs
- ProfileGroupSettingsCollection.cs
- xdrvalidator.cs
- RIPEMD160.cs
- RepeaterItem.cs
- UserThread.cs
- XmlNodeReader.cs
- LocationFactory.cs
- FixedSOMTableCell.cs
- Preprocessor.cs
- FormViewCommandEventArgs.cs
- Inflater.cs
- SystemIPInterfaceStatistics.cs
- SpellerError.cs
- SqlResolver.cs
- TreeNodeMouseHoverEvent.cs
- DetailsViewDeletedEventArgs.cs
- HtmlWindowCollection.cs
- Wildcard.cs
- DesignerVerbToolStripMenuItem.cs
- ActiveDocumentEvent.cs
- RadioButtonList.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- ClientFormsIdentity.cs
- EntitySetBaseCollection.cs
- DataGridCommandEventArgs.cs
- WithParamAction.cs
- ConfigurationManagerInternalFactory.cs
- PriorityRange.cs
- XmlUnspecifiedAttribute.cs
- RelationshipManager.cs
- RoutingEndpointTrait.cs
- VariantWrapper.cs
- Pkcs7Recipient.cs
- AesCryptoServiceProvider.cs
- SymmetricCryptoHandle.cs
- storepermission.cs
- EditorPart.cs
- WebPartTransformerCollection.cs
- DataSourceCacheDurationConverter.cs
- TableLayoutSettingsTypeConverter.cs
- CommandBindingCollection.cs
- TextTreeInsertElementUndoUnit.cs
- ResXDataNode.cs
- StatusBarPanel.cs
- PeerNameRecord.cs
- MobileControlsSectionHandler.cs
- TraceContextEventArgs.cs
- RubberbandSelector.cs
- _SpnDictionary.cs
- MetadataSection.cs
- SwitchElementsCollection.cs
- DriveInfo.cs
- TextRunProperties.cs
- ActiveXSite.cs
- Screen.cs
- PropertyCondition.cs
- ChildDocumentBlock.cs
- EntityDataSourceReferenceGroup.cs
- BaseCollection.cs
- Converter.cs
- Pipe.cs
- ElementNotAvailableException.cs
- XMLSyntaxException.cs
- GetWinFXPath.cs
- ColorContextHelper.cs
- AttributeProviderAttribute.cs
- MembershipValidatePasswordEventArgs.cs
- HybridWebProxyFinder.cs
- Zone.cs
- ArrayTypeMismatchException.cs
- safelink.cs
- ActivityDesignerLayoutSerializers.cs
- ResourceManagerWrapper.cs
- ModuleElement.cs
- TextEncodedRawTextWriter.cs
- ResourceReferenceExpressionConverter.cs
- SqlDataSourceEnumerator.cs
- EntityDesignerDataSourceView.cs
- ChangePassword.cs
- TcpHostedTransportConfiguration.cs
- CodeBlockBuilder.cs
- LoggedException.cs
- autovalidator.cs
- DataTableReaderListener.cs
- TextOnlyOutput.cs
- CodePageUtils.cs
- ActivityDefaults.cs
- ValidationPropertyAttribute.cs
- ValueTable.cs
- FamilyTypefaceCollection.cs
- DataGridViewComboBoxCell.cs
- IdentityReference.cs
- SubMenuStyleCollection.cs