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
- _SpnDictionary.cs
- KeyMatchBuilder.cs
- LinqDataSourceDeleteEventArgs.cs
- GPRECTF.cs
- GridItem.cs
- xamlnodes.cs
- Thumb.cs
- PagerSettings.cs
- CLRBindingWorker.cs
- TextParagraphCache.cs
- UriScheme.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- xsdvalidator.cs
- ACE.cs
- WsdlBuildProvider.cs
- InternalDuplexChannelFactory.cs
- IPEndPointCollection.cs
- RuleInfoComparer.cs
- ListCommandEventArgs.cs
- basecomparevalidator.cs
- CqlGenerator.cs
- GestureRecognizer.cs
- HyperLinkColumn.cs
- SingleObjectCollection.cs
- Frame.cs
- TableAutomationPeer.cs
- SHA1Managed.cs
- VirtualPathProvider.cs
- ValueOfAction.cs
- PropertyMetadata.cs
- DrawingContextWalker.cs
- WebRequestModuleElementCollection.cs
- ManagedIStream.cs
- CachedBitmap.cs
- WpfKnownMemberInvoker.cs
- DependencyObjectPropertyDescriptor.cs
- SpoolingTaskBase.cs
- AssemblyBuilder.cs
- HttpCookieCollection.cs
- WinEventTracker.cs
- BindingCompleteEventArgs.cs
- WorkflowInstance.cs
- ToolStripHighContrastRenderer.cs
- DiscreteKeyFrames.cs
- TCPClient.cs
- BindToObject.cs
- MethodBuilder.cs
- DrawingContextWalker.cs
- ClockController.cs
- LogAppendAsyncResult.cs
- ConstructorExpr.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- DocumentsTrace.cs
- TextElementEditingBehaviorAttribute.cs
- PartManifestEntry.cs
- FileDialogPermission.cs
- PeerNearMe.cs
- ListViewPagedDataSource.cs
- MailWebEventProvider.cs
- XmlChildEnumerator.cs
- CustomErrorCollection.cs
- ReadOnlyCollection.cs
- RangeContentEnumerator.cs
- ExpressionCopier.cs
- SamlAudienceRestrictionCondition.cs
- ParsedAttributeCollection.cs
- SpellerHighlightLayer.cs
- path.cs
- TypeName.cs
- FileDataSourceCache.cs
- ConsumerConnectionPointCollection.cs
- TimelineGroup.cs
- Native.cs
- ColorConvertedBitmap.cs
- PermissionSetEnumerator.cs
- ExpandSegmentCollection.cs
- PatternMatcher.cs
- _NegoState.cs
- FileUtil.cs
- HttpBrowserCapabilitiesBase.cs
- VisualStyleRenderer.cs
- ProjectionAnalyzer.cs
- Thickness.cs
- TransactionManager.cs
- AppSettingsReader.cs
- Figure.cs
- ImageCollectionCodeDomSerializer.cs
- FontStretch.cs
- ColorAnimation.cs
- GiveFeedbackEvent.cs
- SignedInfo.cs
- Semaphore.cs
- CommandField.cs
- ChannelAcceptor.cs
- TextEffectResolver.cs
- WindowsListViewGroupHelper.cs
- RectAnimation.cs
- CodeGen.cs
- SelectionWordBreaker.cs
- OracleRowUpdatingEventArgs.cs