Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Base / MS / Internal / ComponentModel / PropertyKey.cs / 1 / PropertyKey.cs
namespace MS.Internal.ComponentModel { using System; using System.Collections.Generic; using System.Windows; // This structure is used as a key in a dictionary of property key -> property descriptor // The key is unique based on the type the property is attached to, and the property // itself. internal struct PropertyKey : IEquatable{ internal PropertyKey(Type attachedType, DependencyProperty prop) { DependencyProperty = prop; AttachedType = attachedType; _hashCode = AttachedType.GetHashCode() ^ DependencyProperty.GetHashCode(); } public override int GetHashCode() { return _hashCode; } public override bool Equals(object obj) { return Equals((PropertyKey)obj); } public bool Equals(PropertyKey key) { return (key.AttachedType == AttachedType && key.DependencyProperty == DependencyProperty); } public static bool operator ==(PropertyKey key1, PropertyKey key2) { return (key1.AttachedType == key2.AttachedType && key1.DependencyProperty == key2.DependencyProperty); } public static bool operator !=(PropertyKey key1, PropertyKey key2) { return (key1.AttachedType != key2.AttachedType || key1.DependencyProperty != key2.DependencyProperty); } internal DependencyProperty DependencyProperty; internal Type AttachedType; private int _hashCode; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace MS.Internal.ComponentModel { using System; using System.Collections.Generic; using System.Windows; // This structure is used as a key in a dictionary of property key -> property descriptor // The key is unique based on the type the property is attached to, and the property // itself. internal struct PropertyKey : IEquatable { internal PropertyKey(Type attachedType, DependencyProperty prop) { DependencyProperty = prop; AttachedType = attachedType; _hashCode = AttachedType.GetHashCode() ^ DependencyProperty.GetHashCode(); } public override int GetHashCode() { return _hashCode; } public override bool Equals(object obj) { return Equals((PropertyKey)obj); } public bool Equals(PropertyKey key) { return (key.AttachedType == AttachedType && key.DependencyProperty == DependencyProperty); } public static bool operator ==(PropertyKey key1, PropertyKey key2) { return (key1.AttachedType == key2.AttachedType && key1.DependencyProperty == key2.DependencyProperty); } public static bool operator !=(PropertyKey key1, PropertyKey key2) { return (key1.AttachedType != key2.AttachedType || key1.DependencyProperty != key2.DependencyProperty); } internal DependencyProperty DependencyProperty; internal Type AttachedType; private int _hashCode; } } // 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
- SafeThreadHandle.cs
- AddValidationError.cs
- MinMaxParagraphWidth.cs
- GreenMethods.cs
- GroupBox.cs
- AppDomain.cs
- DataSourceHelper.cs
- PageSetupDialog.cs
- WebServiceFault.cs
- XPathAncestorQuery.cs
- AuthenticationService.cs
- WhitespaceSignificantCollectionAttribute.cs
- SystemIcmpV4Statistics.cs
- CodeGotoStatement.cs
- compensatingcollection.cs
- DesignerToolboxInfo.cs
- RegexRunner.cs
- HexParser.cs
- ClientTarget.cs
- ManipulationLogic.cs
- KeyGestureValueSerializer.cs
- ClientFormsIdentity.cs
- ToolStripArrowRenderEventArgs.cs
- LocalClientSecuritySettingsElement.cs
- ToolStripPanel.cs
- MediaElement.cs
- LinqDataSourceSelectEventArgs.cs
- TableTextElementCollectionInternal.cs
- DesignConnection.cs
- XmlValueConverter.cs
- EnumerableRowCollection.cs
- DataBindingCollectionConverter.cs
- XmlLoader.cs
- MonitoringDescriptionAttribute.cs
- DataObjectPastingEventArgs.cs
- ReadOnlyActivityGlyph.cs
- NotFiniteNumberException.cs
- SoapFaultCodes.cs
- DragDrop.cs
- WmlListAdapter.cs
- SqlMetaData.cs
- IConvertible.cs
- Schema.cs
- COMException.cs
- QuaternionConverter.cs
- SafeNativeMethods.cs
- MethodRental.cs
- TypeDescriptionProviderAttribute.cs
- RangeBase.cs
- SystemIcmpV4Statistics.cs
- IncrementalCompileAnalyzer.cs
- StringBuilder.cs
- SmiRequestExecutor.cs
- WorkflowDebuggerSteppingAttribute.cs
- WebPartCatalogAddVerb.cs
- NullReferenceException.cs
- Comparer.cs
- LinqDataSourceStatusEventArgs.cs
- LinqDataSourceSelectEventArgs.cs
- OleDbMetaDataFactory.cs
- DrawingAttributesDefaultValueFactory.cs
- SqlMethods.cs
- WinInetCache.cs
- HandleCollector.cs
- TableItemProviderWrapper.cs
- XhtmlBasicSelectionListAdapter.cs
- ItemsControl.cs
- VerticalAlignConverter.cs
- InvokeWebService.cs
- RsaKeyIdentifierClause.cs
- WsdlImporter.cs
- Repeater.cs
- ErrorEventArgs.cs
- UIElement3D.cs
- InvokePattern.cs
- NegotiateStream.cs
- PolygonHotSpot.cs
- PropertyManager.cs
- StringAnimationUsingKeyFrames.cs
- WorkflowInstanceSuspendedRecord.cs
- XmlEntity.cs
- SafeCryptoHandles.cs
- Hex.cs
- TableSectionStyle.cs
- ResourceContainer.cs
- ProfileManager.cs
- PageClientProxyGenerator.cs
- Utility.cs
- ListControlConvertEventArgs.cs
- _HTTPDateParse.cs
- RegularExpressionValidator.cs
- PageTheme.cs
- ProcessThreadDesigner.cs
- SHA512.cs
- CompositeDataBoundControl.cs
- XmlSerializerAssemblyAttribute.cs
- PropertyDescriptorComparer.cs
- EntitySet.cs
- Choices.cs
- TablePattern.cs