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
- SecurityTokenAttachmentMode.cs
- WindowsToolbarItemAsMenuItem.cs
- AsyncOperation.cs
- XmlTextReaderImplHelpers.cs
- ExpressionSelection.cs
- CellParagraph.cs
- SynchronizedPool.cs
- SecurityDescriptor.cs
- Ray3DHitTestResult.cs
- DetailsViewPageEventArgs.cs
- BrowserTree.cs
- Errors.cs
- TypeEnumerableViewSchema.cs
- GridViewUpdateEventArgs.cs
- Span.cs
- DataTable.cs
- DragDrop.cs
- Latin1Encoding.cs
- DllNotFoundException.cs
- Adorner.cs
- CatalogZoneAutoFormat.cs
- FontFamily.cs
- TextBoxBase.cs
- TransformerTypeCollection.cs
- IgnoreSectionHandler.cs
- Label.cs
- LinkConverter.cs
- SerialReceived.cs
- DbMetaDataColumnNames.cs
- DataGridViewColumnTypeEditor.cs
- CustomAssemblyResolver.cs
- BinaryFormatterWriter.cs
- VariableExpressionConverter.cs
- SamlSerializer.cs
- DataTableTypeConverter.cs
- WorkflowRuntimeServicesBehavior.cs
- InvalidFilterCriteriaException.cs
- AmbientLight.cs
- ProcessHostMapPath.cs
- DotExpr.cs
- HighlightComponent.cs
- ScriptBehaviorDescriptor.cs
- Image.cs
- MatrixValueSerializer.cs
- RouteParameter.cs
- Attributes.cs
- PathStreamGeometryContext.cs
- BidPrivateBase.cs
- ZoneIdentityPermission.cs
- EqualityComparer.cs
- FixedSOMTableRow.cs
- AttributeUsageAttribute.cs
- GroupBoxDesigner.cs
- ConfigurationElement.cs
- InternalBufferManager.cs
- ParallelEnumerableWrapper.cs
- Decimal.cs
- TypeUtil.cs
- ChannelAcceptor.cs
- FormViewDesigner.cs
- ScaleTransform3D.cs
- ContextMenuService.cs
- TraceUtility.cs
- DisplayInformation.cs
- AttachmentService.cs
- ExternalFile.cs
- BuildResult.cs
- UrlAuthorizationModule.cs
- DSASignatureDeformatter.cs
- SystemIcmpV6Statistics.cs
- ContextStack.cs
- SimpleWorkerRequest.cs
- CreateUserWizardStep.cs
- TypeBuilder.cs
- ReservationNotFoundException.cs
- AssociationEndMember.cs
- BitSet.cs
- PolyLineSegment.cs
- HttpClientProtocol.cs
- RedirectionProxy.cs
- SQLStringStorage.cs
- WorkflowDesigner.cs
- Function.cs
- AssociatedControlConverter.cs
- ControlLocalizer.cs
- CodePropertyReferenceExpression.cs
- PropertyDescriptorGridEntry.cs
- InvariantComparer.cs
- DropDownList.cs
- BasicExpandProvider.cs
- dataSvcMapFileLoader.cs
- SegmentInfo.cs
- ContentElement.cs
- GeometryHitTestResult.cs
- OleDbCommandBuilder.cs
- GridViewDeleteEventArgs.cs
- Currency.cs
- RuntimeConfigLKG.cs
- SBCSCodePageEncoding.cs
- SmiMetaDataProperty.cs