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
- X509CertificateRecipientClientCredential.cs
- QueryStringParameter.cs
- ResetableIterator.cs
- hwndwrapper.cs
- PointConverter.cs
- XmlSchemaDocumentation.cs
- ProcessRequestArgs.cs
- XamlHostingSection.cs
- MetadataItem.cs
- DLinqColumnProvider.cs
- WebPartConnectionsConnectVerb.cs
- Int32Animation.cs
- ExtractedStateEntry.cs
- HtmlLink.cs
- WebContext.cs
- TreeNode.cs
- NameSpaceEvent.cs
- PostBackOptions.cs
- Animatable.cs
- ResourcePool.cs
- SafeHandles.cs
- ByteStreamMessage.cs
- Propagator.ExtentPlaceholderCreator.cs
- PopupEventArgs.cs
- CompilationRelaxations.cs
- PageClientProxyGenerator.cs
- _NegoState.cs
- ImportCatalogPart.cs
- ResourceProperty.cs
- HttpModuleAction.cs
- CompositionTarget.cs
- ListBoxChrome.cs
- TreeNodeStyleCollection.cs
- HitTestResult.cs
- ApplicationContext.cs
- ServiceInfoCollection.cs
- AndMessageFilter.cs
- BufferedReadStream.cs
- SeekableReadStream.cs
- MembershipValidatePasswordEventArgs.cs
- SvcFileManager.cs
- NamespaceImport.cs
- SectionInput.cs
- QualificationDataAttribute.cs
- DataSvcMapFileSerializer.cs
- NaturalLanguageHyphenator.cs
- HttpModuleActionCollection.cs
- InstanceDescriptor.cs
- SqlStatistics.cs
- InputScopeAttribute.cs
- RoleGroupCollection.cs
- UTF32Encoding.cs
- objectquery_tresulttype.cs
- XmlDocumentViewSchema.cs
- ChangeInterceptorAttribute.cs
- DataSourceControlBuilder.cs
- EventsTab.cs
- QuaternionAnimation.cs
- AQNBuilder.cs
- KeyNotFoundException.cs
- PermissionSetTriple.cs
- ImageSource.cs
- HybridDictionary.cs
- Freezable.cs
- FormatPage.cs
- ServiceOperationWrapper.cs
- EmptyImpersonationContext.cs
- DataGridViewRowPostPaintEventArgs.cs
- X509CertificateEndpointIdentity.cs
- SimpleHandlerFactory.cs
- TextBoxAutoCompleteSourceConverter.cs
- GridViewColumnHeaderAutomationPeer.cs
- XmlQualifiedNameTest.cs
- AttachedAnnotationChangedEventArgs.cs
- SettingsAttributes.cs
- Timer.cs
- SmiEventSink_DeferedProcessing.cs
- ActivityWithResultWrapper.cs
- NetSectionGroup.cs
- SettingsSavedEventArgs.cs
- HttpInputStream.cs
- DefaultBinder.cs
- SchemaUtility.cs
- SocketException.cs
- CodeTypeOfExpression.cs
- SmtpReplyReader.cs
- StateInitializationDesigner.cs
- VBIdentifierNameEditor.cs
- SafeFileMappingHandle.cs
- DataGridRow.cs
- GlobalDataBindingHandler.cs
- DES.cs
- DirtyTextRange.cs
- ObjectStateFormatter.cs
- SessionEndingCancelEventArgs.cs
- ScriptComponentDescriptor.cs
- WebUtil.cs
- ActiveXHelper.cs
- BasicExpandProvider.cs
- RequestCachePolicyConverter.cs