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
- linebase.cs
- Brush.cs
- DashStyles.cs
- Encoder.cs
- BooleanProjectedSlot.cs
- HttpResponseBase.cs
- Vars.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- CalendarItem.cs
- ScrollViewerAutomationPeer.cs
- BaseTemplateParser.cs
- CommandField.cs
- XmlDocument.cs
- ContentFileHelper.cs
- Script.cs
- InputProcessorProfiles.cs
- WebServiceFaultDesigner.cs
- GridToolTip.cs
- UIElementAutomationPeer.cs
- XmlAttributeCollection.cs
- TagMapInfo.cs
- KeyInterop.cs
- BatchParser.cs
- IntSecurity.cs
- RequestCacheManager.cs
- DeclaredTypeElementCollection.cs
- PixelShader.cs
- TextTreeTextElementNode.cs
- RichTextBox.cs
- ElementMarkupObject.cs
- GeneralTransform3DTo2DTo3D.cs
- DbConnectionPoolGroup.cs
- AspNetSynchronizationContext.cs
- XamlSerializerUtil.cs
- Helpers.cs
- unsafeIndexingFilterStream.cs
- EntityContainerEntitySet.cs
- TextTreeUndoUnit.cs
- CodeDirectiveCollection.cs
- XmlNodeReader.cs
- RuntimeDelegateArgument.cs
- PropertyChangeTracker.cs
- RouteUrlExpressionBuilder.cs
- UpdateProgress.cs
- DependencyPropertyValueSerializer.cs
- OdbcConnectionOpen.cs
- Light.cs
- DataGridViewCellPaintingEventArgs.cs
- DeferredElementTreeState.cs
- TreeNodeMouseHoverEvent.cs
- sqlmetadatafactory.cs
- ByteAnimationBase.cs
- DependsOnAttribute.cs
- Exceptions.cs
- ProviderUtil.cs
- SafeHandles.cs
- RegexRunner.cs
- StringConverter.cs
- DbConnectionPoolOptions.cs
- OdbcRowUpdatingEvent.cs
- DesignerUtils.cs
- LinearKeyFrames.cs
- CannotUnloadAppDomainException.cs
- SBCSCodePageEncoding.cs
- SystemKeyConverter.cs
- TdsParserHelperClasses.cs
- MoveSizeWinEventHandler.cs
- WindowsAltTab.cs
- XmlReturnWriter.cs
- Avt.cs
- DebugViewWriter.cs
- ResourceReferenceExpressionConverter.cs
- AuthorizationRuleCollection.cs
- RawStylusInputCustomData.cs
- ImageIndexConverter.cs
- SkinBuilder.cs
- ScriptIgnoreAttribute.cs
- AssemblyCollection.cs
- DocumentPageTextView.cs
- AdRotator.cs
- XmlName.cs
- EdmType.cs
- UserNamePasswordServiceCredential.cs
- WebPartConnection.cs
- DbProviderFactory.cs
- HotSpotCollection.cs
- TreeView.cs
- EdmProviderManifest.cs
- HostingEnvironmentException.cs
- RootContext.cs
- UrlPath.cs
- TypeCacheManager.cs
- SQLCharsStorage.cs
- NetStream.cs
- SiteMembershipCondition.cs
- DataGridViewCheckBoxColumn.cs
- IntSecurity.cs
- EntityParameterCollection.cs
- SoapWriter.cs
- HttpCachePolicyWrapper.cs