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
- TreeViewItem.cs
- TdsParserStaticMethods.cs
- DefaultWorkflowLoaderService.cs
- OpenTypeLayout.cs
- OneOfConst.cs
- RoutedEventValueSerializer.cs
- PositiveTimeSpanValidator.cs
- CompletedAsyncResult.cs
- CqlErrorHelper.cs
- TextOptions.cs
- ProfileSettings.cs
- SettingsProperty.cs
- EntityContainer.cs
- RuntimeCompatibilityAttribute.cs
- PathSegmentCollection.cs
- WorkflowValidationFailedException.cs
- CollectionDataContractAttribute.cs
- WebBaseEventKeyComparer.cs
- XmlAttributeCollection.cs
- DrawingServices.cs
- XPathAncestorIterator.cs
- DataViewListener.cs
- ConstantSlot.cs
- OrderPreservingPipeliningMergeHelper.cs
- AssemblyBuilder.cs
- WebPartTracker.cs
- ExpressionNormalizer.cs
- WorkflowIdleElement.cs
- BitmapEffectGeneralTransform.cs
- String.cs
- PtsContext.cs
- ToolStripItemCollection.cs
- AssemblyHash.cs
- DllNotFoundException.cs
- ColumnWidthChangingEvent.cs
- LineServicesCallbacks.cs
- DataViewManagerListItemTypeDescriptor.cs
- TrustManagerMoreInformation.cs
- HotSpot.cs
- PersonalizablePropertyEntry.cs
- UrlPropertyAttribute.cs
- PagedDataSource.cs
- ListViewSelectEventArgs.cs
- WebPartDisplayMode.cs
- BitmapCacheBrush.cs
- _SSPISessionCache.cs
- WebPartMenuStyle.cs
- DefinitionUpdate.cs
- JournalEntry.cs
- EnumConverter.cs
- ContentPropertyAttribute.cs
- ComAdminWrapper.cs
- WizardStepBase.cs
- OSFeature.cs
- HttpCookie.cs
- ConnectionConsumerAttribute.cs
- HtmlInputSubmit.cs
- ImageIndexConverter.cs
- PropertyItemInternal.cs
- KnownBoxes.cs
- Literal.cs
- ContainerTracking.cs
- ErrorHandler.cs
- ExtensibleClassFactory.cs
- SkinBuilder.cs
- NodeFunctions.cs
- PropertyEmitterBase.cs
- ToolboxCategoryItems.cs
- ContentTextAutomationPeer.cs
- DoubleConverter.cs
- CodeSubDirectoriesCollection.cs
- StorageMappingItemCollection.cs
- WindowInteropHelper.cs
- Delegate.cs
- PrivateFontCollection.cs
- QuotedPrintableStream.cs
- RedirectionProxy.cs
- GetBrowserTokenRequest.cs
- SQLInt32.cs
- _PooledStream.cs
- DataSetUtil.cs
- NativeCompoundFileAPIs.cs
- ControlCachePolicy.cs
- Attributes.cs
- RoutedUICommand.cs
- XmlILConstructAnalyzer.cs
- ConstraintStruct.cs
- Vars.cs
- FixedDocument.cs
- ObjectView.cs
- ToolboxDataAttribute.cs
- _CommandStream.cs
- PerspectiveCamera.cs
- Tablet.cs
- CompositionDesigner.cs
- TypefaceMetricsCache.cs
- QilGeneratorEnv.cs
- SourceElementsCollection.cs
- HashHelper.cs
- InstanceKeyCollisionException.cs