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
- FontStretches.cs
- CryptoProvider.cs
- XmlAttributeOverrides.cs
- BrushConverter.cs
- SecUtil.cs
- PriorityItem.cs
- SmiTypedGetterSetter.cs
- ListViewUpdatedEventArgs.cs
- Visual.cs
- SafeReadContext.cs
- PopupRootAutomationPeer.cs
- XmlSchemaComplexContentRestriction.cs
- XComponentModel.cs
- PageParserFilter.cs
- Int64KeyFrameCollection.cs
- GridViewAutoFormat.cs
- ReadWriteSpinLock.cs
- HandleCollector.cs
- SelectionProviderWrapper.cs
- UncommonField.cs
- FirstMatchCodeGroup.cs
- ConsumerConnectionPoint.cs
- Stack.cs
- SwitchLevelAttribute.cs
- ProxyAttribute.cs
- DrawingImage.cs
- RequestDescription.cs
- SqlUserDefinedAggregateAttribute.cs
- SystemGatewayIPAddressInformation.cs
- Lease.cs
- SafePEFileHandle.cs
- RequestCacheValidator.cs
- ScriptReferenceEventArgs.cs
- Evaluator.cs
- PartialTrustVisibleAssembly.cs
- GeneralTransform3DGroup.cs
- EntityDataSourceWrapperCollection.cs
- InheritanceContextChangedEventManager.cs
- XmlSchemaImport.cs
- WindowsUserNameCachingSecurityTokenAuthenticator.cs
- COM2ColorConverter.cs
- util.cs
- SettingsAttributeDictionary.cs
- PrivilegeNotHeldException.cs
- DocobjHost.cs
- PreservationFileWriter.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- AccessDataSourceView.cs
- BooleanStorage.cs
- DesignerActionPanel.cs
- XmlTextReader.cs
- XpsResource.cs
- HtmlElementCollection.cs
- TdsParserHelperClasses.cs
- Span.cs
- Assert.cs
- SessionEndingEventArgs.cs
- PropertyConverter.cs
- BuildProviderCollection.cs
- SrgsElementFactoryCompiler.cs
- DependencyProperty.cs
- ComboBoxItem.cs
- ButtonChrome.cs
- WebZoneDesigner.cs
- GenericUriParser.cs
- CodePageEncoding.cs
- WebPartsSection.cs
- BasicKeyConstraint.cs
- Viewport3DAutomationPeer.cs
- TemplateParser.cs
- RawStylusInputCustomData.cs
- AspCompat.cs
- DeflateEmulationStream.cs
- CompleteWizardStep.cs
- StructuralComparisons.cs
- AnnotationResourceChangedEventArgs.cs
- xmlfixedPageInfo.cs
- BinaryFormatter.cs
- ProtocolException.cs
- SymDocumentType.cs
- PropertyItem.cs
- CodeConstructor.cs
- VoiceChangeEventArgs.cs
- DataGridViewColumn.cs
- TranslateTransform3D.cs
- ToolStripTextBox.cs
- ProjectionCamera.cs
- Attribute.cs
- SharedConnectionWorkflowTransactionService.cs
- TdsParserStateObject.cs
- _NestedMultipleAsyncResult.cs
- XmlIlVisitor.cs
- SymmetricSecurityBindingElement.cs
- OneOfTypeConst.cs
- hwndwrapper.cs
- HostedHttpRequestAsyncResult.cs
- ExceptionUtil.cs
- XmlDictionaryReader.cs
- MarkupProperty.cs
- ClientConvert.cs