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
- QueryOutputWriter.cs
- NegotiateStream.cs
- objectresult_tresulttype.cs
- SoapObjectReader.cs
- CommandExpr.cs
- Attribute.cs
- UInt32Storage.cs
- CommandLibraryHelper.cs
- BindingMemberInfo.cs
- ProviderMetadata.cs
- ElementNotAvailableException.cs
- IdentityNotMappedException.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- SByteConverter.cs
- userdatakeys.cs
- EndpointDiscoveryMetadata11.cs
- RotateTransform.cs
- UpdatePanelTrigger.cs
- PeerName.cs
- OpenFileDialog.cs
- HelpPage.cs
- ReflectEventDescriptor.cs
- Light.cs
- DataObjectEventArgs.cs
- XmlTextReaderImplHelpers.cs
- XmlConverter.cs
- ProfessionalColorTable.cs
- ResXResourceWriter.cs
- DataGridTextBox.cs
- NativeMethods.cs
- StringComparer.cs
- tooltip.cs
- DecoderFallbackWithFailureFlag.cs
- AxisAngleRotation3D.cs
- ReaderWriterLockSlim.cs
- indexingfiltermarshaler.cs
- RowToParametersTransformer.cs
- ButtonAutomationPeer.cs
- PropertyCondition.cs
- AnimationClockResource.cs
- CodePageUtils.cs
- SqlLiftIndependentRowExpressions.cs
- PageTheme.cs
- IProvider.cs
- FunctionQuery.cs
- RequestQueue.cs
- ContractInstanceProvider.cs
- Page.cs
- Button.cs
- TemplateBindingExpression.cs
- Point3DAnimation.cs
- CreateRefExpr.cs
- PermissionRequestEvidence.cs
- WmlCalendarAdapter.cs
- XmlSchemas.cs
- NameTable.cs
- SharedConnectionInfo.cs
- AspNetSynchronizationContext.cs
- _SpnDictionary.cs
- KnownTypes.cs
- GridViewDeletedEventArgs.cs
- XmlSchemaAnnotated.cs
- SQLByte.cs
- GeometryValueSerializer.cs
- StateInitializationDesigner.cs
- CalendarAutomationPeer.cs
- WmfPlaceableFileHeader.cs
- _Events.cs
- SchemaDeclBase.cs
- ReferencedAssemblyResolver.cs
- EncodingDataItem.cs
- XmlChoiceIdentifierAttribute.cs
- SqlTriggerAttribute.cs
- ErrorRuntimeConfig.cs
- RichTextBox.cs
- InlineObject.cs
- DataBindingHandlerAttribute.cs
- PropertiesTab.cs
- XMLUtil.cs
- DateTimeConverter2.cs
- WebPartVerbsEventArgs.cs
- PointCollectionValueSerializer.cs
- Pen.cs
- ReadWriteControlDesigner.cs
- WebPartConnectionsCancelEventArgs.cs
- SymmetricCryptoHandle.cs
- RelatedImageListAttribute.cs
- LoginUtil.cs
- PenThreadWorker.cs
- SqlClientPermission.cs
- DatatypeImplementation.cs
- ValidationResult.cs
- ParserExtension.cs
- StackOverflowException.cs
- GrabHandleGlyph.cs
- MetadataExchangeClient.cs
- CodeExpressionCollection.cs
- OracleInternalConnection.cs
- Set.cs
- SizeConverter.cs