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
- ParameterRefs.cs
- versioninfo.cs
- Model3D.cs
- VersionPair.cs
- WmpBitmapDecoder.cs
- JsonWriter.cs
- SqlCommandBuilder.cs
- HttpConfigurationContext.cs
- EndOfStreamException.cs
- QueryComponents.cs
- Variable.cs
- Message.cs
- HostSecurityManager.cs
- ProfileGroupSettingsCollection.cs
- CompressedStack.cs
- ButtonFlatAdapter.cs
- EntityDataSourceValidationException.cs
- ToolStripItemTextRenderEventArgs.cs
- MessageQueuePermissionAttribute.cs
- Identifier.cs
- GlobalItem.cs
- InputProcessorProfilesLoader.cs
- InternalTypeHelper.cs
- TcpStreams.cs
- HotSpot.cs
- CodeDOMProvider.cs
- TemplateControlBuildProvider.cs
- NumberSubstitution.cs
- BinaryObjectReader.cs
- HitTestFilterBehavior.cs
- ReferencedCollectionType.cs
- Variant.cs
- DeclarativeConditionsCollection.cs
- NumberAction.cs
- HtmlWindowCollection.cs
- LinkClickEvent.cs
- CodeComment.cs
- WebPartVerbsEventArgs.cs
- WorkflowNamespace.cs
- HandoffBehavior.cs
- LineUtil.cs
- ProfessionalColors.cs
- ObservableCollection.cs
- UnsafeNetInfoNativeMethods.cs
- HwndHostAutomationPeer.cs
- EntityClientCacheKey.cs
- RowUpdatingEventArgs.cs
- NativeMethods.cs
- WrappedIUnknown.cs
- MSG.cs
- PackageFilter.cs
- Panel.cs
- AssemblySettingAttributes.cs
- StrongName.cs
- URLIdentityPermission.cs
- MachineKeyValidationConverter.cs
- MouseWheelEventArgs.cs
- Light.cs
- TextMarkerSource.cs
- UpdateManifestForBrowserApplication.cs
- InputReportEventArgs.cs
- RectangleConverter.cs
- WebHttpElement.cs
- MsdtcClusterUtils.cs
- SQLGuid.cs
- EntityDataSource.cs
- Rect.cs
- UserControlBuildProvider.cs
- ImageSource.cs
- CurrentChangedEventManager.cs
- ConfigXmlReader.cs
- DataSvcMapFileSerializer.cs
- Identifier.cs
- ISO2022Encoding.cs
- SchemaCollectionCompiler.cs
- DetailsViewPagerRow.cs
- ProfilePropertyNameValidator.cs
- Schema.cs
- RuntimeHandles.cs
- brushes.cs
- MessagingDescriptionAttribute.cs
- WizardPanel.cs
- SecurityContext.cs
- LoopExpression.cs
- PageAsyncTask.cs
- XmlQualifiedNameTest.cs
- DataGridViewRow.cs
- SecurityUtils.cs
- Int32EqualityComparer.cs
- WebPartTransformer.cs
- SystemPens.cs
- SqlBooleanMismatchVisitor.cs
- MDIControlStrip.cs
- codemethodreferenceexpression.cs
- UserPreferenceChangingEventArgs.cs
- SchemaConstraints.cs
- BuildTopDownAttribute.cs
- Adorner.cs
- CryptoHandle.cs
- WindowsListViewItem.cs