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
- VisualStyleElement.cs
- PartialTrustVisibleAssembly.cs
- XmlDictionaryString.cs
- EmbeddedMailObjectsCollection.cs
- Int16AnimationUsingKeyFrames.cs
- DbConnectionOptions.cs
- QueryGeneratorBase.cs
- TypedReference.cs
- DocumentReferenceCollection.cs
- PrtTicket_Base.cs
- FontEditor.cs
- PerspectiveCamera.cs
- NameValueFileSectionHandler.cs
- ButtonStandardAdapter.cs
- ClipboardData.cs
- BamlMapTable.cs
- Clipboard.cs
- HandlerFactoryCache.cs
- Imaging.cs
- DataGridViewCellPaintingEventArgs.cs
- CannotUnloadAppDomainException.cs
- Configuration.cs
- CodeStatement.cs
- TdsParserSessionPool.cs
- CheckableControlBaseAdapter.cs
- SQLDateTime.cs
- CodeTypeReferenceSerializer.cs
- JoinSymbol.cs
- IsolatedStorageFileStream.cs
- InheritablePropertyChangeInfo.cs
- Helper.cs
- ReverseComparer.cs
- SecurityDocument.cs
- TableLayoutRowStyleCollection.cs
- SynchronizingStream.cs
- NonClientArea.cs
- SoapMessage.cs
- FunctionUpdateCommand.cs
- EntityProviderServices.cs
- TimeSpanStorage.cs
- DataGridViewCellValidatingEventArgs.cs
- SizeAnimationUsingKeyFrames.cs
- HistoryEventArgs.cs
- XmlSchemaSimpleContentExtension.cs
- FormViewPagerRow.cs
- TriggerBase.cs
- CacheMode.cs
- CompiledRegexRunnerFactory.cs
- EntityDataSourceDesigner.cs
- HashCodeCombiner.cs
- TiffBitmapEncoder.cs
- ModelUIElement3D.cs
- DbModificationCommandTree.cs
- PropertyEmitter.cs
- IssuerInformation.cs
- PropertyFilterAttribute.cs
- securitycriticaldata.cs
- UInt32Storage.cs
- SoapEnumAttribute.cs
- EncoderParameter.cs
- NTAccount.cs
- AnimationLayer.cs
- Property.cs
- MemberCollection.cs
- ProfilePropertyNameValidator.cs
- HttpCacheParams.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- VectorKeyFrameCollection.cs
- DictionaryManager.cs
- TypeSystemProvider.cs
- JournalEntryListConverter.cs
- ExpressionDumper.cs
- securitycriticaldata.cs
- AsyncPostBackTrigger.cs
- FontFaceLayoutInfo.cs
- GridSplitter.cs
- ChildDocumentBlock.cs
- CacheForPrimitiveTypes.cs
- Byte.cs
- DrawingAttributeSerializer.cs
- XmlSchemaSet.cs
- SyndicationDeserializer.cs
- LayoutUtils.cs
- UnaryNode.cs
- PropertyCollection.cs
- SymLanguageVendor.cs
- InOutArgument.cs
- DrawingBrush.cs
- Binding.cs
- DataPagerFieldCollection.cs
- UriTemplateVariableQueryValue.cs
- MergeLocalizationDirectives.cs
- DbProviderFactory.cs
- CodeTypeParameterCollection.cs
- XmlMapping.cs
- DrawingAttributes.cs
- CompoundFileDeflateTransform.cs
- HostedNamedPipeTransportManager.cs
- AnnotationHelper.cs
- PasswordValidationException.cs