Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / ComponentModel / PropertyKey.cs / 1305600 / 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
- StylusEditingBehavior.cs
- PositiveTimeSpanValidator.cs
- OdbcInfoMessageEvent.cs
- PointCollectionConverter.cs
- Vector3DIndependentAnimationStorage.cs
- ServiceOperation.cs
- TextRangeSerialization.cs
- UserControlAutomationPeer.cs
- CodeDomSerializer.cs
- Missing.cs
- ActivityTypeCodeDomSerializer.cs
- MouseWheelEventArgs.cs
- MemberInitExpression.cs
- MemberMaps.cs
- TextPointerBase.cs
- SQLInt64.cs
- Validator.cs
- AttachedPropertyMethodSelector.cs
- Attribute.cs
- HwndTarget.cs
- AmbientValueAttribute.cs
- GestureRecognitionResult.cs
- XmlDesigner.cs
- SystemIPInterfaceProperties.cs
- SafeEventHandle.cs
- QilDataSource.cs
- GroupBox.cs
- messageonlyhwndwrapper.cs
- Page.cs
- NativeMethodsCLR.cs
- Attachment.cs
- EncoderExceptionFallback.cs
- DataChangedEventManager.cs
- UInt64Storage.cs
- HtmlToClrEventProxy.cs
- DataColumnChangeEvent.cs
- ExpandoClass.cs
- DataReceivedEventArgs.cs
- OleDbParameterCollection.cs
- SimpleFieldTemplateFactory.cs
- FilterableData.cs
- ForeignConstraint.cs
- Screen.cs
- DragEventArgs.cs
- OnOperation.cs
- RequestResizeEvent.cs
- SqlNotificationRequest.cs
- TaskHelper.cs
- Literal.cs
- ObjectHelper.cs
- ConnectionPointConverter.cs
- BamlRecordWriter.cs
- XmlSchemaAttributeGroupRef.cs
- SecurityState.cs
- NonBatchDirectoryCompiler.cs
- XslVisitor.cs
- DesignerCalendarAdapter.cs
- DynamicValueConverter.cs
- ImageListUtils.cs
- GridViewPageEventArgs.cs
- AppearanceEditorPart.cs
- DropDownList.cs
- ThicknessAnimationBase.cs
- TrackingProfileManager.cs
- Journal.cs
- EventRouteFactory.cs
- SelectedDatesCollection.cs
- ExpressionBuilderCollection.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- MissingMethodException.cs
- MetabaseSettings.cs
- DataStorage.cs
- StandardCommands.cs
- _AutoWebProxyScriptHelper.cs
- MarkupExtensionParser.cs
- XmlSchemaSequence.cs
- DynamicResourceExtension.cs
- ImageCodecInfo.cs
- OleDragDropHandler.cs
- HatchBrush.cs
- TextSelection.cs
- SubMenuStyle.cs
- ApplicationInterop.cs
- DomainLiteralReader.cs
- BaseResourcesBuildProvider.cs
- TraceSection.cs
- OleDbParameter.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- SQLInt32Storage.cs
- SmiGettersStream.cs
- DataBindEngine.cs
- OleDbReferenceCollection.cs
- ClientUIRequest.cs
- IpcClientManager.cs
- IgnoreSectionHandler.cs
- SequenceFullException.cs
- DataSourceBooleanViewSchemaConverter.cs
- RuntimeHandles.cs
- CounterCreationDataConverter.cs
- MenuRendererClassic.cs