Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- SQLBytesStorage.cs
- ConfigurationElement.cs
- BackEase.cs
- ContentTextAutomationPeer.cs
- Line.cs
- DesignTimeHTMLTextWriter.cs
- InvalidFilterCriteriaException.cs
- XmlComplianceUtil.cs
- SetStateEventArgs.cs
- DoubleAnimation.cs
- ClientBuildManagerCallback.cs
- RootBuilder.cs
- MessageDesigner.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- EmptyCollection.cs
- oledbmetadatacolumnnames.cs
- EventProviderClassic.cs
- RootDesignerSerializerAttribute.cs
- DataListGeneralPage.cs
- JsonFormatGeneratorStatics.cs
- CompleteWizardStep.cs
- ArrayWithOffset.cs
- Grid.cs
- FrameworkTemplate.cs
- FixedDocument.cs
- DetailsViewInsertedEventArgs.cs
- XmlSerializerVersionAttribute.cs
- AtomicFile.cs
- StickyNoteHelper.cs
- CriticalFinalizerObject.cs
- IOException.cs
- FormViewUpdateEventArgs.cs
- NetworkStream.cs
- _LazyAsyncResult.cs
- ItemsChangedEventArgs.cs
- SwitchAttribute.cs
- InstanceBehavior.cs
- WmlTextViewAdapter.cs
- PageThemeCodeDomTreeGenerator.cs
- DllNotFoundException.cs
- DragDrop.cs
- Animatable.cs
- PerfCounterSection.cs
- RecognizeCompletedEventArgs.cs
- CryptoProvider.cs
- ComboBoxRenderer.cs
- ThreadExceptionDialog.cs
- XmlAnyElementAttributes.cs
- AutomationIdentifierGuids.cs
- SqlDataSourceQuery.cs
- XmlNodeChangedEventManager.cs
- VisualTarget.cs
- DataGridColumn.cs
- HttpModuleCollection.cs
- HttpCapabilitiesEvaluator.cs
- KoreanCalendar.cs
- Mouse.cs
- TextUtf8RawTextWriter.cs
- DataList.cs
- StylusPointPropertyUnit.cs
- APCustomTypeDescriptor.cs
- ListViewItem.cs
- COM2Enum.cs
- IPipelineRuntime.cs
- COAUTHIDENTITY.cs
- OLEDB_Util.cs
- StorageTypeMapping.cs
- ProfilePropertySettings.cs
- GenerateHelper.cs
- HandledMouseEvent.cs
- FileCodeGroup.cs
- BitVector32.cs
- PersonalizableTypeEntry.cs
- UserControl.cs
- DebuggerAttributes.cs
- EndpointIdentityConverter.cs
- SqlParameterCollection.cs
- DataErrorValidationRule.cs
- WinFormsSecurity.cs
- PeerCollaborationPermission.cs
- MgmtResManager.cs
- DataExpression.cs
- GroupItem.cs
- CompressedStack.cs
- DecoderExceptionFallback.cs
- FixedTextSelectionProcessor.cs
- AlignmentXValidation.cs
- GraphicsPath.cs
- XmlSchemaAnyAttribute.cs
- SystemIcons.cs
- HttpCachePolicyElement.cs
- Helpers.cs
- SystemTcpStatistics.cs
- LoginUtil.cs
- UseLicense.cs
- RefreshPropertiesAttribute.cs
- Root.cs
- SmtpReplyReaderFactory.cs
- ClientSettingsSection.cs
- DecoratedNameAttribute.cs