Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- FormsAuthenticationTicket.cs
- JsonClassDataContract.cs
- UrlMappingsSection.cs
- CollectionTypeElement.cs
- ForceCopyBuildProvider.cs
- SchemaCollectionCompiler.cs
- UncommonField.cs
- BaseCollection.cs
- StoreItemCollection.Loader.cs
- TypeConverterHelper.cs
- DetailsViewPagerRow.cs
- FixedElement.cs
- BamlRecordWriter.cs
- FontDriver.cs
- OutOfProcStateClientManager.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- DictionaryEditChange.cs
- Pair.cs
- Bitmap.cs
- Subtree.cs
- DependencyObjectPropertyDescriptor.cs
- FactoryMaker.cs
- CategoryGridEntry.cs
- SqlInternalConnectionSmi.cs
- Size.cs
- WhitespaceRuleReader.cs
- SafeReversePInvokeHandle.cs
- ParserHooks.cs
- TextEditorTyping.cs
- ConnectorDragDropGlyph.cs
- CurrencyManager.cs
- DbProviderSpecificTypePropertyAttribute.cs
- TextEncodedRawTextWriter.cs
- NegationPusher.cs
- QilInvoke.cs
- ContentHostHelper.cs
- ObjectSet.cs
- ExpressionLink.cs
- LinqDataSourceDeleteEventArgs.cs
- EntitySet.cs
- XmlValueConverter.cs
- Symbol.cs
- IdentityModelDictionary.cs
- SqlResolver.cs
- StringDictionaryCodeDomSerializer.cs
- XmlComplianceUtil.cs
- XmlDataSourceNodeDescriptor.cs
- PtsCache.cs
- PrivateFontCollection.cs
- DiagnosticTrace.cs
- ArraySortHelper.cs
- LightweightCodeGenerator.cs
- ClientRolePrincipal.cs
- AssociationTypeEmitter.cs
- SqlExpander.cs
- TextEndOfParagraph.cs
- SafeArrayTypeMismatchException.cs
- MemberMaps.cs
- WebPartDisplayModeEventArgs.cs
- ScalarType.cs
- PenContexts.cs
- DynamicILGenerator.cs
- ExpressionPrinter.cs
- InProcStateClientManager.cs
- NavigationService.cs
- SynchronizedInputAdaptor.cs
- MonitorWrapper.cs
- StringValueSerializer.cs
- ContainerParaClient.cs
- Int32Storage.cs
- DPCustomTypeDescriptor.cs
- BrushValueSerializer.cs
- MDIControlStrip.cs
- WizardForm.cs
- SspiWrapper.cs
- TextDecorationCollectionConverter.cs
- SafeRegistryHandle.cs
- TypeSource.cs
- BitmapEffectInput.cs
- DesignerOptions.cs
- WebPartEditorOkVerb.cs
- FontUnit.cs
- FixedTextContainer.cs
- ByteFacetDescriptionElement.cs
- TransformConverter.cs
- SharedUtils.cs
- SByte.cs
- TextTreeExtractElementUndoUnit.cs
- CodeSubDirectoriesCollection.cs
- CollectionsUtil.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- ConfigurationLocationCollection.cs
- Pair.cs
- PeerTransportBindingElement.cs
- XmlSchemaExternal.cs
- ZipPackage.cs
- ExtensionDataObject.cs
- GeneralTransform.cs
- XslAst.cs
- Pair.cs