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
- configsystem.cs
- TraceXPathNavigator.cs
- LineSegment.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- CacheRequest.cs
- CommonProperties.cs
- WebEvents.cs
- SourceElementsCollection.cs
- SspiNegotiationTokenProvider.cs
- HostUtils.cs
- PanelContainerDesigner.cs
- XmlDataSourceNodeDescriptor.cs
- EdmFunctionAttribute.cs
- MdbDataFileEditor.cs
- TextLineResult.cs
- IndependentlyAnimatedPropertyMetadata.cs
- PathSegment.cs
- ProtocolsConfigurationHandler.cs
- DataServiceHost.cs
- ColorAnimation.cs
- ControlParameter.cs
- commandenforcer.cs
- ScalarOps.cs
- DrawingContext.cs
- SettingsPropertyValueCollection.cs
- ScriptResourceInfo.cs
- Control.cs
- XamlPoint3DCollectionSerializer.cs
- OperandQuery.cs
- MetaDataInfo.cs
- ComponentSerializationService.cs
- HttpHandlerActionCollection.cs
- OpCopier.cs
- SoapIncludeAttribute.cs
- HttpChannelHelper.cs
- BamlLocalizableResourceKey.cs
- EventProviderWriter.cs
- SQLSingle.cs
- SmiMetaDataProperty.cs
- TextEndOfParagraph.cs
- JapaneseCalendar.cs
- ThemeableAttribute.cs
- X509InitiatorCertificateClientElement.cs
- ReachSerializableProperties.cs
- ContainerFilterService.cs
- DataServiceContext.cs
- TextClipboardData.cs
- DelayLoadType.cs
- ClientCredentials.cs
- XmlHierarchicalDataSourceView.cs
- HttpRuntimeSection.cs
- XmlBinaryReader.cs
- ValidatingCollection.cs
- followingsibling.cs
- TransactionInterop.cs
- HierarchicalDataBoundControlAdapter.cs
- OLEDB_Enum.cs
- Font.cs
- SignatureResourcePool.cs
- PKCS1MaskGenerationMethod.cs
- Mutex.cs
- DiagnosticTrace.cs
- OleAutBinder.cs
- _BufferOffsetSize.cs
- XPathQilFactory.cs
- HashHelper.cs
- keycontainerpermission.cs
- DataTableNameHandler.cs
- TextMarkerSource.cs
- FactoryMaker.cs
- TextHidden.cs
- _ProxyChain.cs
- ALinqExpressionVisitor.cs
- basecomparevalidator.cs
- CultureNotFoundException.cs
- ContentTypeSettingClientMessageFormatter.cs
- AppModelKnownContentFactory.cs
- newinstructionaction.cs
- DataBoundLiteralControl.cs
- UrlMapping.cs
- OdbcConnectionPoolProviderInfo.cs
- OpCellTreeNode.cs
- DoubleCollectionValueSerializer.cs
- LogicalTreeHelper.cs
- BrushMappingModeValidation.cs
- SByte.cs
- TreeNodeStyle.cs
- SynchronizedDispatch.cs
- FramingEncoders.cs
- OutputWindow.cs
- DataGridTableStyleMappingNameEditor.cs
- SettingsContext.cs
- InheritedPropertyChangedEventArgs.cs
- MsmqDecodeHelper.cs
- LicFileLicenseProvider.cs
- SystemWebCachingSectionGroup.cs
- CompilationSection.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- DataQuery.cs
- ClientRolePrincipal.cs