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
- MsmqVerifier.cs
- HebrewNumber.cs
- TextEndOfLine.cs
- NumberAction.cs
- Transform3D.cs
- SQLRoleProvider.cs
- RawStylusActions.cs
- webproxy.cs
- TypeName.cs
- CodeDOMUtility.cs
- TimeEnumHelper.cs
- PrintDocument.cs
- CompositeDesignerAccessibleObject.cs
- UserControl.cs
- KerberosSecurityTokenProvider.cs
- RegionData.cs
- ParseNumbers.cs
- VersionedStreamOwner.cs
- DrawingContext.cs
- VarRemapper.cs
- FontNamesConverter.cs
- StylusSystemGestureEventArgs.cs
- WindowsToolbarAsMenu.cs
- formatter.cs
- prompt.cs
- PartialArray.cs
- ScaleTransform.cs
- IndexedString.cs
- TableAdapterManagerMethodGenerator.cs
- Int16AnimationUsingKeyFrames.cs
- Axis.cs
- DBSqlParserTable.cs
- DataServiceQuery.cs
- Match.cs
- SafeNativeMethodsMilCoreApi.cs
- HostUtils.cs
- SymbolMethod.cs
- GeneralTransform.cs
- SetterBaseCollection.cs
- TdsRecordBufferSetter.cs
- StylusShape.cs
- DiscoveryDocumentSerializer.cs
- Message.cs
- Roles.cs
- EntityDataReader.cs
- UnicastIPAddressInformationCollection.cs
- ContractReference.cs
- AttachedAnnotationChangedEventArgs.cs
- TCPClient.cs
- ListViewTableCell.cs
- HtmlTable.cs
- CatalogZoneDesigner.cs
- LinkUtilities.cs
- VariantWrapper.cs
- TextEditorTables.cs
- PathSegmentCollection.cs
- Pool.cs
- Storyboard.cs
- IdentityHolder.cs
- CompilerGeneratedAttribute.cs
- CompilerGlobalScopeAttribute.cs
- Predicate.cs
- COM2ExtendedBrowsingHandler.cs
- TileBrush.cs
- DispatcherExceptionEventArgs.cs
- MetafileHeader.cs
- DataGridViewToolTip.cs
- input.cs
- StreamInfo.cs
- BrowserTree.cs
- EditingMode.cs
- DesignerDataSourceView.cs
- PathGeometry.cs
- EncryptedXml.cs
- EventMappingSettingsCollection.cs
- WorkflowViewStateService.cs
- BrushMappingModeValidation.cs
- StateWorkerRequest.cs
- IncrementalHitTester.cs
- Content.cs
- DesignTimeType.cs
- PkcsMisc.cs
- MenuEventArgs.cs
- ReadOnlyObservableCollection.cs
- Vector3DCollection.cs
- ValidationHelper.cs
- TrustLevel.cs
- StringBuilder.cs
- XamlSerializerUtil.cs
- SqlLiftIndependentRowExpressions.cs
- AutomationPatternInfo.cs
- HttpsChannelFactory.cs
- ConnectorRouter.cs
- PeekCompletedEventArgs.cs
- AssemblyBuilder.cs
- SynchronousChannelMergeEnumerator.cs
- XhtmlConformanceSection.cs
- DispatchWrapper.cs
- Imaging.cs
- CodeMemberProperty.cs