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
- PlatformCulture.cs
- List.cs
- AutomationElementCollection.cs
- SqlInternalConnectionTds.cs
- UnsafeNativeMethods.cs
- ListViewDataItem.cs
- WebPartConnection.cs
- BindingListCollectionView.cs
- TreeViewItemAutomationPeer.cs
- ProfilePropertySettingsCollection.cs
- FolderLevelBuildProviderCollection.cs
- XmlWrappingWriter.cs
- HeaderCollection.cs
- ProvidePropertyAttribute.cs
- Decimal.cs
- DependentList.cs
- WizardForm.cs
- BuilderInfo.cs
- XPathParser.cs
- EdmRelationshipRoleAttribute.cs
- StyleCollection.cs
- InputGestureCollection.cs
- FileLevelControlBuilderAttribute.cs
- XmlAtomicValue.cs
- UserControlBuildProvider.cs
- BeginStoryboard.cs
- DbConnectionClosed.cs
- ImageConverter.cs
- Int16AnimationUsingKeyFrames.cs
- SafeNativeMethods.cs
- Stroke.cs
- sqlser.cs
- handlecollector.cs
- FlagsAttribute.cs
- MergeExecutor.cs
- UserPersonalizationStateInfo.cs
- RsaSecurityKey.cs
- XMLUtil.cs
- UnsafeNativeMethods.cs
- BackgroundWorker.cs
- RegionData.cs
- SslStream.cs
- TableLayoutStyle.cs
- SHA256.cs
- SerializationSectionGroup.cs
- PaintEvent.cs
- BuilderPropertyEntry.cs
- CodeSnippetTypeMember.cs
- BrowsableAttribute.cs
- XmlEntityReference.cs
- Cursors.cs
- StrokeNodeOperations.cs
- MetricEntry.cs
- VisualStyleRenderer.cs
- DbConnectionStringBuilder.cs
- NetworkInformationPermission.cs
- SystemDropShadowChrome.cs
- NativeMethods.cs
- StatusBarItemAutomationPeer.cs
- TwoPhaseCommit.cs
- RowSpanVector.cs
- MergePropertyDescriptor.cs
- WmlPanelAdapter.cs
- SqlMethodAttribute.cs
- DbXmlEnabledProviderManifest.cs
- IMembershipProvider.cs
- WindowsListViewItemStartMenu.cs
- basecomparevalidator.cs
- RuleProcessor.cs
- AssemblyNameProxy.cs
- LinqDataSourceSelectEventArgs.cs
- RegistryPermission.cs
- StorageAssociationSetMapping.cs
- DataGridSortingEventArgs.cs
- OpCodes.cs
- X509Utils.cs
- TextTreeTextNode.cs
- FacetEnabledSchemaElement.cs
- SrgsElement.cs
- XmlCharType.cs
- Application.cs
- WindowsListViewGroupSubsetLink.cs
- RootBuilder.cs
- CultureSpecificStringDictionary.cs
- Marshal.cs
- ResXDataNode.cs
- IOException.cs
- InputLanguageCollection.cs
- SystemIcons.cs
- ProcessModelInfo.cs
- TextPointerBase.cs
- ConnectionString.cs
- ConfigUtil.cs
- processwaithandle.cs
- EncoderParameter.cs
- MatchingStyle.cs
- TransactionState.cs
- UseManagedPresentationBindingElementImporter.cs
- LineMetrics.cs
- returneventsaver.cs