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
- Vector.cs
- TraceLevelHelper.cs
- OrderedEnumerableRowCollection.cs
- LoginView.cs
- ArgumentException.cs
- NumericUpDownAccelerationCollection.cs
- SingleConverter.cs
- ConfigXmlElement.cs
- DocumentPage.cs
- PartManifestEntry.cs
- ScriptMethodAttribute.cs
- DataControlFieldCell.cs
- ProgressBarBrushConverter.cs
- RewritingValidator.cs
- LambdaCompiler.Expressions.cs
- WebEvents.cs
- ExceptionNotification.cs
- CollectionBuilder.cs
- ConstructorBuilder.cs
- MappingItemCollection.cs
- ServiceOperation.cs
- SmtpCommands.cs
- XPathArrayIterator.cs
- VSDExceptions.cs
- ContentIterators.cs
- ListBoxChrome.cs
- UnsafePeerToPeerMethods.cs
- Invariant.cs
- StringStorage.cs
- EntityDataSourceMemberPath.cs
- ColumnMapVisitor.cs
- ColorTransformHelper.cs
- ParameterToken.cs
- DataGridViewDesigner.cs
- DocumentPageViewAutomationPeer.cs
- TreeViewCancelEvent.cs
- HierarchicalDataBoundControl.cs
- InstanceOwnerException.cs
- SecurityState.cs
- UpdateException.cs
- ControlParameter.cs
- AstTree.cs
- ExceptionUtil.cs
- XPathChildIterator.cs
- SiteMapPathDesigner.cs
- querybuilder.cs
- DocumentSchemaValidator.cs
- ProfileBuildProvider.cs
- XmlCollation.cs
- IisTraceWebEventProvider.cs
- ModelItemDictionaryImpl.cs
- TemplateBamlTreeBuilder.cs
- ValidatorAttribute.cs
- StrokeCollectionDefaultValueFactory.cs
- LicenseProviderAttribute.cs
- ReadWriteSpinLock.cs
- RuntimeConfig.cs
- SchemaNamespaceManager.cs
- KeyValuePair.cs
- XmlAutoDetectWriter.cs
- OleDbPermission.cs
- EntityCommandDefinition.cs
- PrincipalPermission.cs
- ISO2022Encoding.cs
- QueryOperationResponseOfT.cs
- AttachedPropertyBrowsableAttribute.cs
- DataColumnMapping.cs
- DataComponentNameHandler.cs
- LineSegment.cs
- DesignerLoader.cs
- XmlValidatingReaderImpl.cs
- EditorPart.cs
- ListItemConverter.cs
- GridViewDeleteEventArgs.cs
- MachineSettingsSection.cs
- TcpClientChannel.cs
- BindableTemplateBuilder.cs
- AudioFormatConverter.cs
- HighContrastHelper.cs
- KeyTimeConverter.cs
- LinearGradientBrush.cs
- WebContext.cs
- UDPClient.cs
- XmlSignatureProperties.cs
- Deserializer.cs
- MergeFailedEvent.cs
- DataGridViewToolTip.cs
- AnimatedTypeHelpers.cs
- PrivilegedConfigurationManager.cs
- XmlDataContract.cs
- SqlRemoveConstantOrderBy.cs
- XhtmlBasicImageAdapter.cs
- StaticFileHandler.cs
- DynamicActivityXamlReader.cs
- CompareInfo.cs
- ConnectionPointCookie.cs
- ExpressionBuilder.cs
- BufferedConnection.cs
- TrackingMemoryStream.cs
- ComponentConverter.cs