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
- DataTablePropertyDescriptor.cs
- GridErrorDlg.cs
- CompiledXpathExpr.cs
- DefaultObjectMappingItemCollection.cs
- SqlConnectionString.cs
- EventSinkHelperWriter.cs
- TiffBitmapEncoder.cs
- RuntimeConfigLKG.cs
- QuaternionConverter.cs
- ProfileSection.cs
- Converter.cs
- DrawListViewSubItemEventArgs.cs
- HiddenFieldPageStatePersister.cs
- QuadraticBezierSegment.cs
- EntityKeyElement.cs
- ResourceAssociationTypeEnd.cs
- XmlSchemaSimpleType.cs
- DurableInstanceProvider.cs
- SpeechRecognizer.cs
- TextServicesDisplayAttribute.cs
- ProfileGroupSettingsCollection.cs
- DataGridViewRowHeaderCell.cs
- TagMapInfo.cs
- EnumerableWrapperWeakToStrong.cs
- AdRotator.cs
- EnvelopedSignatureTransform.cs
- XmlSchemaIdentityConstraint.cs
- IssuedTokenParametersEndpointAddressElement.cs
- BlockExpression.cs
- XmlCompatibilityReader.cs
- Subtree.cs
- OperandQuery.cs
- XmlnsDefinitionAttribute.cs
- DesignerCommandSet.cs
- WebPartManager.cs
- MultiPropertyDescriptorGridEntry.cs
- CombinedHttpChannel.cs
- TailCallAnalyzer.cs
- ListMarkerLine.cs
- MenuEventArgs.cs
- MutexSecurity.cs
- DynamicRenderer.cs
- GenericTypeParameterBuilder.cs
- CheckBoxField.cs
- CheckBox.cs
- ConfigurationPropertyCollection.cs
- ProfilePropertyNameValidator.cs
- XPathScanner.cs
- Function.cs
- UpdateCompiler.cs
- IIS7UserPrincipal.cs
- DesignerDeviceConfig.cs
- HtmlShimManager.cs
- DataSourceControlBuilder.cs
- XmlHierarchicalEnumerable.cs
- ViewEventArgs.cs
- HttpApplication.cs
- Point3DConverter.cs
- EllipseGeometry.cs
- StateMachineSubscriptionManager.cs
- RegisteredHiddenField.cs
- WebPartDeleteVerb.cs
- CommentAction.cs
- NullableBoolConverter.cs
- MessageQueueEnumerator.cs
- xmlfixedPageInfo.cs
- ResourcePermissionBaseEntry.cs
- ValidationRule.cs
- ToolStripContainerDesigner.cs
- ClientTargetCollection.cs
- ActivityTypeResolver.xaml.cs
- AutomationAttributeInfo.cs
- PopOutPanel.cs
- FileNotFoundException.cs
- WaveHeader.cs
- FileSystemEventArgs.cs
- Range.cs
- BinaryMethodMessage.cs
- MulticastIPAddressInformationCollection.cs
- AsyncDataRequest.cs
- Renderer.cs
- Inflater.cs
- MetadataUtil.cs
- ToolStripPanelRow.cs
- PageTheme.cs
- SerializationException.cs
- DataContractSet.cs
- Metadata.cs
- RijndaelManagedTransform.cs
- RefExpr.cs
- ThicknessConverter.cs
- MiniModule.cs
- MemberDomainMap.cs
- WhitespaceRule.cs
- SubpageParaClient.cs
- OdbcRowUpdatingEvent.cs
- Compress.cs
- TableRowGroup.cs
- DataSourceCacheDurationConverter.cs
- FloaterBaseParagraph.cs