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
- ProtocolsConfigurationHandler.cs
- FixedTextContainer.cs
- printdlgexmarshaler.cs
- XsltSettings.cs
- SpeechRecognizer.cs
- MatchingStyle.cs
- XsdBuilder.cs
- ListControlConvertEventArgs.cs
- HGlobalSafeHandle.cs
- CodeGotoStatement.cs
- CommandCollectionEditor.cs
- FixedSchema.cs
- RightsManagementEncryptedStream.cs
- ObjectRef.cs
- NativeMethods.cs
- HttpServerUtilityWrapper.cs
- BooleanKeyFrameCollection.cs
- MexHttpsBindingElement.cs
- ButtonStandardAdapter.cs
- WebPartManagerInternals.cs
- StylusSystemGestureEventArgs.cs
- SqlConnectionHelper.cs
- XmlElementList.cs
- OdbcReferenceCollection.cs
- ConnectionConsumerAttribute.cs
- ExpressionPrefixAttribute.cs
- _TimerThread.cs
- DbConnectionHelper.cs
- ServiceReflector.cs
- Repeater.cs
- PseudoWebRequest.cs
- TextAction.cs
- ListBindingHelper.cs
- RSAPKCS1SignatureDeformatter.cs
- DataGridHeaderBorder.cs
- UidPropertyAttribute.cs
- SmtpReplyReaderFactory.cs
- HostingEnvironment.cs
- InternalConfigSettingsFactory.cs
- XPathException.cs
- IdentitySection.cs
- DeclaredTypeElement.cs
- RelationshipDetailsRow.cs
- SimpleColumnProvider.cs
- CallContext.cs
- RIPEMD160.cs
- ResourceDictionary.cs
- ServicePointManager.cs
- ProfileEventArgs.cs
- ObjectItemCollection.cs
- LoginViewDesigner.cs
- ExecutionPropertyManager.cs
- WebPartPersonalization.cs
- UnsafeNativeMethods.cs
- KeyValueConfigurationElement.cs
- SQLInt32.cs
- CheckoutException.cs
- EntityDesignerBuildProvider.cs
- DoubleAnimation.cs
- Polyline.cs
- ObjectDataSourceSelectingEventArgs.cs
- TraceXPathNavigator.cs
- MenuCommandsChangedEventArgs.cs
- CircleEase.cs
- HMACSHA512.cs
- DataGridViewCellStateChangedEventArgs.cs
- CollectionView.cs
- HttpCachePolicy.cs
- MetadataCache.cs
- StrongNameIdentityPermission.cs
- EventSourceCreationData.cs
- TogglePattern.cs
- Context.cs
- SBCSCodePageEncoding.cs
- CommunicationObject.cs
- ZipIOLocalFileBlock.cs
- RTTypeWrapper.cs
- VectorConverter.cs
- ComplexBindingPropertiesAttribute.cs
- Blend.cs
- StringResourceManager.cs
- NullNotAllowedCollection.cs
- DictationGrammar.cs
- QueryAsyncResult.cs
- SiteMapDataSourceView.cs
- QilStrConcat.cs
- WebPartMinimizeVerb.cs
- UnicastIPAddressInformationCollection.cs
- TrackBar.cs
- WinFormsComponentEditor.cs
- RuleElement.cs
- RtfFormatStack.cs
- NumberFunctions.cs
- webeventbuffer.cs
- BuildDependencySet.cs
- FieldNameLookup.cs
- HelpInfo.cs
- wgx_commands.cs
- IncrementalCompileAnalyzer.cs
- XPathExpr.cs