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
- PointLight.cs
- XPathAxisIterator.cs
- StaticResourceExtension.cs
- ItemCheckedEvent.cs
- ZipPackage.cs
- ColorInterpolationModeValidation.cs
- UTF7Encoding.cs
- MonthCalendar.cs
- Debug.cs
- GraphicsPathIterator.cs
- DocumentSequence.cs
- NotifyInputEventArgs.cs
- SecureStringHasher.cs
- OleDbPropertySetGuid.cs
- TextServicesDisplayAttribute.cs
- GridViewDeleteEventArgs.cs
- BasicExpandProvider.cs
- RadioButtonList.cs
- DeadCharTextComposition.cs
- FileIOPermission.cs
- DiagnosticTraceSchemas.cs
- TextBox.cs
- DataService.cs
- FlowchartStart.xaml.cs
- SecurityException.cs
- WhitespaceRuleLookup.cs
- CompareInfo.cs
- BaseParagraph.cs
- CompiledRegexRunner.cs
- IsolatedStorageFilePermission.cs
- DescendantOverDescendantQuery.cs
- manifestimages.cs
- HitTestResult.cs
- TextMessageEncodingBindingElement.cs
- EntityConnectionStringBuilderItem.cs
- WmpBitmapDecoder.cs
- DependencyPropertyAttribute.cs
- dataprotectionpermission.cs
- FrameworkElementFactoryMarkupObject.cs
- RectConverter.cs
- TextLineResult.cs
- PrimaryKeyTypeConverter.cs
- DataGridViewCellValueEventArgs.cs
- AuditLevel.cs
- CompoundFileDeflateTransform.cs
- SecurityContext.cs
- CustomErrorsSection.cs
- _CookieModule.cs
- FileIOPermission.cs
- XmlExtensionFunction.cs
- OrderedDictionary.cs
- FieldBuilder.cs
- DoubleLinkListEnumerator.cs
- ValueHandle.cs
- ContentOperations.cs
- HyperLink.cs
- DataTableNewRowEvent.cs
- XmlILStorageConverter.cs
- MetadataArtifactLoaderCompositeResource.cs
- CopyCodeAction.cs
- SQLInt64Storage.cs
- EdmToObjectNamespaceMap.cs
- DBSchemaRow.cs
- XpsS0ValidatingLoader.cs
- UiaCoreApi.cs
- AutomationEventArgs.cs
- FontUnitConverter.cs
- ErrorEventArgs.cs
- XmlHierarchyData.cs
- WeakRefEnumerator.cs
- PropertyConverter.cs
- SizeFConverter.cs
- ElementUtil.cs
- ImportException.cs
- ObjectMaterializedEventArgs.cs
- CodeIndexerExpression.cs
- FtpRequestCacheValidator.cs
- recordstate.cs
- AuthenticationServiceManager.cs
- DiscoveryDocumentSearchPattern.cs
- FixedSOMTable.cs
- ViewValidator.cs
- SimpleHandlerFactory.cs
- XslAstAnalyzer.cs
- XmlSchema.cs
- FloatUtil.cs
- WebRequest.cs
- SystemDropShadowChrome.cs
- PrintDialog.cs
- Panel.cs
- ProtectedConfiguration.cs
- IndexedGlyphRun.cs
- ConfigurationStrings.cs
- DescendantBaseQuery.cs
- DatatypeImplementation.cs
- RetrieveVirtualItemEventArgs.cs
- Privilege.cs
- ConfigUtil.cs
- EntitySqlQueryCacheEntry.cs
- NotifyIcon.cs