Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- DataException.cs
- PartialClassGenerationTask.cs
- CalendarDateRange.cs
- CollectionChangedEventManager.cs
- BrowserCapabilitiesFactoryBase.cs
- AppSecurityManager.cs
- DefaultShape.cs
- mda.cs
- Blend.cs
- ResourceExpressionBuilder.cs
- IssuedTokenClientCredential.cs
- MsmqTransportSecurity.cs
- TemplateBindingExtensionConverter.cs
- CheckBoxStandardAdapter.cs
- RotateTransform.cs
- CompositeFontParser.cs
- ClientScriptManager.cs
- ArrayWithOffset.cs
- EntityStoreSchemaFilterEntry.cs
- ArraySegment.cs
- WCFBuildProvider.cs
- Util.cs
- CompressionTracing.cs
- SchemaMerger.cs
- ExcCanonicalXml.cs
- AndCondition.cs
- Number.cs
- HttpCacheVary.cs
- RealProxy.cs
- DataGridSortCommandEventArgs.cs
- HelpPage.cs
- SqlTriggerContext.cs
- XmlCustomFormatter.cs
- GroupByExpressionRewriter.cs
- DefaultObjectMappingItemCollection.cs
- XmlSchemaParticle.cs
- OrderByQueryOptionExpression.cs
- PathFigureCollectionConverter.cs
- XmlC14NWriter.cs
- WindowsRichEditRange.cs
- WmlLinkAdapter.cs
- AnonymousIdentificationSection.cs
- BindingGroup.cs
- NonDualMessageSecurityOverHttp.cs
- ComboBoxAutomationPeer.cs
- DBPropSet.cs
- WSHttpSecurityElement.cs
- ImageSourceConverter.cs
- EntityClientCacheEntry.cs
- ComponentEditorForm.cs
- RegisteredArrayDeclaration.cs
- SliderAutomationPeer.cs
- ContentTextAutomationPeer.cs
- X509CertificateCollection.cs
- IndentedWriter.cs
- DelayedRegex.cs
- CacheEntry.cs
- RelatedImageListAttribute.cs
- SchemaType.cs
- DataFormat.cs
- UserControlParser.cs
- SiteMapPathDesigner.cs
- StrokeCollectionDefaultValueFactory.cs
- TimeSpanConverter.cs
- SolidColorBrush.cs
- WebPartsPersonalizationAuthorization.cs
- SafeCancelMibChangeNotify.cs
- MenuItem.cs
- AsymmetricSignatureDeformatter.cs
- SubMenuStyleCollection.cs
- LoopExpression.cs
- NotSupportedException.cs
- PartialArray.cs
- ConnectionStringSettingsCollection.cs
- SchemaTypeEmitter.cs
- StringAnimationBase.cs
- DefaultMergeHelper.cs
- StorageAssociationSetMapping.cs
- OptionalColumn.cs
- GroupDescription.cs
- XmlSignificantWhitespace.cs
- SafeRegistryHandle.cs
- MailAddressCollection.cs
- TemplatePagerField.cs
- GlyphsSerializer.cs
- TemplatePropertyEntry.cs
- AffineTransform3D.cs
- SystemBrushes.cs
- WpfGeneratedKnownTypes.cs
- GridLength.cs
- BoundField.cs
- PerspectiveCamera.cs
- WindowsStatic.cs
- SelectingProviderEventArgs.cs
- ChunkedMemoryStream.cs
- RMPublishingDialog.cs
- DetailsViewUpdatedEventArgs.cs
- WinFormsComponentEditor.cs
- ListItem.cs
- RelationshipDetailsCollection.cs