Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Shared / MS / Internal / FreezableOperations.cs / 1 / 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. //---------------------------------------------------------------------------- // //// 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
- KeyManager.cs
- XmlnsCache.cs
- SamlAuthenticationClaimResource.cs
- AggregateNode.cs
- SubMenuStyleCollectionEditor.cs
- SafePEFileHandle.cs
- SettingsPropertyCollection.cs
- AssociationSetMetadata.cs
- DataMemberConverter.cs
- HttpPostedFileBase.cs
- DeploymentSection.cs
- SerializationInfoEnumerator.cs
- UnsafeNativeMethodsCLR.cs
- SafeViewOfFileHandle.cs
- CodeStatement.cs
- DocumentsTrace.cs
- HealthMonitoringSection.cs
- StreamResourceInfo.cs
- ObjectNavigationPropertyMapping.cs
- XmlEncoding.cs
- TypeConverter.cs
- QilTargetType.cs
- RuntimeHandles.cs
- SourceFileBuildProvider.cs
- ConnectionStringsExpressionEditor.cs
- TypeRestriction.cs
- LinkArea.cs
- BaseCodePageEncoding.cs
- X509Certificate2Collection.cs
- TagPrefixInfo.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ObjectStateEntry.cs
- HTMLTagNameToTypeMapper.cs
- ProxySimple.cs
- ContextBase.cs
- XmlLanguageConverter.cs
- DateTimeOffset.cs
- MenuItem.cs
- VariableAction.cs
- CacheHelper.cs
- NeedSkipTokenVisitor.cs
- XamlToRtfWriter.cs
- SamlAuthorityBinding.cs
- AnchoredBlock.cs
- Helper.cs
- TagPrefixCollection.cs
- ProfileModule.cs
- XmlWriter.cs
- ViewCellRelation.cs
- Decorator.cs
- CodeCatchClauseCollection.cs
- MappingItemCollection.cs
- EncodingNLS.cs
- ObjectDataSourceFilteringEventArgs.cs
- WebPartUtil.cs
- SchemaEntity.cs
- XamlToRtfParser.cs
- TextTreeRootTextBlock.cs
- PropertyPathConverter.cs
- CustomExpression.cs
- KeyPullup.cs
- Brush.cs
- ServiceOperationUIEditor.cs
- ObjectSpanRewriter.cs
- FilterEventArgs.cs
- UpdatableWrapper.cs
- DefaultParameterValueAttribute.cs
- ProxyWebPartManager.cs
- ChannelBuilder.cs
- TabletDeviceInfo.cs
- InvalidPrinterException.cs
- PartialTrustValidationBehavior.cs
- VarRefManager.cs
- ActivityDesigner.cs
- GeneralTransform3DTo2DTo3D.cs
- RegistrySecurity.cs
- EdmRelationshipRoleAttribute.cs
- KeyInfo.cs
- Connector.cs
- ItemsChangedEventArgs.cs
- ChangeProcessor.cs
- MenuItemBindingCollection.cs
- QueryInterceptorAttribute.cs
- StorageAssociationTypeMapping.cs
- SettingsBindableAttribute.cs
- SystemDropShadowChrome.cs
- SecurityDescriptor.cs
- RadioButton.cs
- UnionExpr.cs
- UnsafePeerToPeerMethods.cs
- PartialClassGenerationTaskInternal.cs
- DrawingAttributeSerializer.cs
- ContainerUIElement3D.cs
- FusionWrap.cs
- MenuItem.cs
- ResourceIDHelper.cs
- FormsAuthentication.cs
- UInt32.cs
- UIPermission.cs
- PropertyConverter.cs