Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / ComponentModel / PropertyKey.cs / 1305600 / 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
- CodeNamespaceImportCollection.cs
- CheckBoxStandardAdapter.cs
- DetailsViewUpdatedEventArgs.cs
- RootProfilePropertySettingsCollection.cs
- SimpleBitVector32.cs
- SecurityChannel.cs
- ConfigXmlCDataSection.cs
- CommentEmitter.cs
- CompoundFileReference.cs
- WebScriptMetadataMessageEncoderFactory.cs
- ArrayList.cs
- CursorEditor.cs
- XmlIlTypeHelper.cs
- StreamGeometryContext.cs
- XhtmlBasicTextViewAdapter.cs
- PasswordBoxAutomationPeer.cs
- HebrewNumber.cs
- ChangeBlockUndoRecord.cs
- PersonalizationProviderCollection.cs
- EncodingStreamWrapper.cs
- GlyphCache.cs
- ZoneIdentityPermission.cs
- XmlChildNodes.cs
- GifBitmapEncoder.cs
- ErrorRuntimeConfig.cs
- ValidationService.cs
- AxisAngleRotation3D.cs
- DataServiceRequestOfT.cs
- CheckBoxField.cs
- StringHandle.cs
- InlineUIContainer.cs
- UIElement3DAutomationPeer.cs
- Viewport3DAutomationPeer.cs
- HierarchicalDataBoundControl.cs
- TextOnlyOutput.cs
- ObjectHandle.cs
- ExpressionVisitorHelpers.cs
- RenderData.cs
- DecimalAnimation.cs
- ContentFileHelper.cs
- HandlerMappingMemo.cs
- NotSupportedException.cs
- RuntimeConfigurationRecord.cs
- DocumentStream.cs
- ProcessInputEventArgs.cs
- HtmlElement.cs
- ASCIIEncoding.cs
- GeneralTransform3DCollection.cs
- Bezier.cs
- XamlInterfaces.cs
- PointHitTestResult.cs
- _RequestLifetimeSetter.cs
- BindingBase.cs
- SourceSwitch.cs
- SecurityPermission.cs
- SectionRecord.cs
- HtmlInputReset.cs
- FlatButtonAppearance.cs
- NullNotAllowedCollection.cs
- FixedTextSelectionProcessor.cs
- AdornerDecorator.cs
- WebControlAdapter.cs
- LinqDataSourceStatusEventArgs.cs
- Console.cs
- HttpPostedFileWrapper.cs
- NameValuePair.cs
- WindowInteropHelper.cs
- RoleManagerModule.cs
- Button.cs
- DataSourceView.cs
- TextTreeTextBlock.cs
- RuleSettings.cs
- MexHttpsBindingElement.cs
- TableItemStyle.cs
- DomainUpDown.cs
- ColumnBinding.cs
- PhoneCall.cs
- DelegateTypeInfo.cs
- EdmPropertyAttribute.cs
- Effect.cs
- DesignerSerializationOptionsAttribute.cs
- ResourcePool.cs
- ChangeToolStripParentVerb.cs
- DispatchChannelSink.cs
- IndexedString.cs
- FrugalMap.cs
- OrderedDictionary.cs
- XomlCompilerHelpers.cs
- OuterGlowBitmapEffect.cs
- Rotation3DAnimationBase.cs
- Matrix.cs
- OdbcDataAdapter.cs
- BitmapImage.cs
- Form.cs
- HwndHostAutomationPeer.cs
- SqlNotificationRequest.cs
- PenLineCapValidation.cs
- _SslSessionsCache.cs
- TiffBitmapEncoder.cs
- AddInStore.cs