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
- PrintingPermissionAttribute.cs
- BindingValueChangedEventArgs.cs
- EnterpriseServicesHelper.cs
- MemberInfoSerializationHolder.cs
- ColumnHeader.cs
- UIPropertyMetadata.cs
- ParallelLoopState.cs
- SchemaObjectWriter.cs
- ColorConverter.cs
- DataRowIndexBuffer.cs
- CubicEase.cs
- SpecialNameAttribute.cs
- ClientProxyGenerator.cs
- ProxyElement.cs
- HostingEnvironmentSection.cs
- arc.cs
- SqlCachedBuffer.cs
- Translator.cs
- LocatorPart.cs
- mactripleDES.cs
- ProcessModule.cs
- TokenBasedSetEnumerator.cs
- shaperfactory.cs
- DefaultEventAttribute.cs
- RequestBringIntoViewEventArgs.cs
- hresults.cs
- DBBindings.cs
- PersistenceProviderBehavior.cs
- TypeConverterValueSerializer.cs
- HttpDebugHandler.cs
- DbConnectionPoolOptions.cs
- DocumentViewerConstants.cs
- System.Data_BID.cs
- Substitution.cs
- ClockController.cs
- ViewUtilities.cs
- Subset.cs
- InsufficientMemoryException.cs
- MimeTypePropertyAttribute.cs
- SchemaCreator.cs
- DataGridColumnCollectionEditor.cs
- StrokeIntersection.cs
- ScriptingRoleServiceSection.cs
- EventMappingSettings.cs
- BufferBuilder.cs
- PackageFilter.cs
- TimeSpanParse.cs
- UserControl.cs
- Timer.cs
- Accessible.cs
- LZCodec.cs
- Form.cs
- GridPattern.cs
- GeometryValueSerializer.cs
- FontDriver.cs
- PasswordRecovery.cs
- XmlSchemaComplexType.cs
- JournalEntryStack.cs
- ManagementScope.cs
- ContextMenuStrip.cs
- EdmError.cs
- ProcessHostMapPath.cs
- HttpHandlerAction.cs
- TabItemWrapperAutomationPeer.cs
- ToggleButtonAutomationPeer.cs
- SqlConnectionHelper.cs
- ManipulationInertiaStartingEventArgs.cs
- RegistrationServices.cs
- DetailsViewRowCollection.cs
- ObjectListCommandCollection.cs
- WebPartMinimizeVerb.cs
- DSACryptoServiceProvider.cs
- arabicshape.cs
- ApplicationCommands.cs
- DropShadowBitmapEffect.cs
- FontDialog.cs
- SqlAliasesReferenced.cs
- FormatConvertedBitmap.cs
- StateManagedCollection.cs
- LayeredChannelListener.cs
- TypedReference.cs
- WebPartZoneCollection.cs
- CodeComment.cs
- PEFileEvidenceFactory.cs
- UnsafeNativeMethods.cs
- WebRequestModulesSection.cs
- KeyInterop.cs
- AttributeUsageAttribute.cs
- ComponentResourceManager.cs
- BasicHttpBindingCollectionElement.cs
- IndexerNameAttribute.cs
- SQLBoolean.cs
- BitmapEffectOutputConnector.cs
- SqlIdentifier.cs
- XmlNodeWriter.cs
- TreeBuilderBamlTranslator.cs
- KeyFrames.cs
- ToolboxItemFilterAttribute.cs
- DbConnectionInternal.cs
- TextBoxRenderer.cs