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
- RectangleConverter.cs
- WebResourceUtil.cs
- ResourceDictionaryCollection.cs
- CounterSetInstanceCounterDataSet.cs
- BaseTemplateBuildProvider.cs
- InstanceKeyCollisionException.cs
- Parser.cs
- WebException.cs
- HttpRuntimeSection.cs
- GridViewRowPresenterBase.cs
- DetailsViewUpdatedEventArgs.cs
- ExpressionBindingCollection.cs
- BaseDataList.cs
- UnsafeNativeMethodsPenimc.cs
- ScriptControlManager.cs
- Calendar.cs
- DecimalKeyFrameCollection.cs
- _NetworkingPerfCounters.cs
- AuthenticationModulesSection.cs
- CFStream.cs
- ServicePoint.cs
- SerializerProvider.cs
- ProfilePropertySettingsCollection.cs
- HMACRIPEMD160.cs
- UInt16Converter.cs
- ISO2022Encoding.cs
- XPathAncestorQuery.cs
- FileAccessException.cs
- AttributeProviderAttribute.cs
- EncryptedPackageFilter.cs
- ByteStream.cs
- HttpListenerContext.cs
- Stackframe.cs
- DropTarget.cs
- MarkupCompiler.cs
- XmlSchemaObjectTable.cs
- QueryOutputWriterV1.cs
- ScrollBar.cs
- ImageListImageEditor.cs
- SettingsProviderCollection.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- Debug.cs
- ExternalFile.cs
- BaseDataBoundControl.cs
- DbInsertCommandTree.cs
- RealProxy.cs
- SemanticResolver.cs
- TextViewElement.cs
- Empty.cs
- SinglePhaseEnlistment.cs
- InputProviderSite.cs
- ValueQuery.cs
- TemplateInstanceAttribute.cs
- SEHException.cs
- FixedSOMLineRanges.cs
- ExceptionHandler.cs
- XslTransform.cs
- Roles.cs
- TableItemPattern.cs
- DictionaryBase.cs
- ContextMenu.cs
- SymbolType.cs
- DataPagerField.cs
- BitHelper.cs
- SafeTokenHandle.cs
- MobileDeviceCapabilitiesSectionHandler.cs
- ApplicationFileCodeDomTreeGenerator.cs
- EncodingTable.cs
- InternalDispatchObject.cs
- DataContract.cs
- EventlogProvider.cs
- TableItemPatternIdentifiers.cs
- PermissionListSet.cs
- WebSysDefaultValueAttribute.cs
- FunctionQuery.cs
- CustomLineCap.cs
- MetadataItemEmitter.cs
- CheckBoxList.cs
- XmlEnumAttribute.cs
- CloseSequence.cs
- Model3D.cs
- VariableReference.cs
- CodeTypeParameter.cs
- SourceElementsCollection.cs
- DelegateBodyWriter.cs
- SignatureSummaryDialog.cs
- XamlFrame.cs
- WebRequest.cs
- IntegerFacetDescriptionElement.cs
- HtmlFormWrapper.cs
- RequestTimeoutManager.cs
- EntityDesignerDataSourceView.cs
- ParagraphVisual.cs
- Rect3DConverter.cs
- GPPOINT.cs
- CodeAccessSecurityEngine.cs
- WaitHandle.cs
- TogglePattern.cs
- HttpCookie.cs
- SizeConverter.cs