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
- ValueProviderWrapper.cs
- CodeSubDirectoriesCollection.cs
- ToolStripGripRenderEventArgs.cs
- CreateUserWizardAutoFormat.cs
- BreadCrumbTextConverter.cs
- SynthesizerStateChangedEventArgs.cs
- DataServiceProcessingPipeline.cs
- DependencyPropertyDescriptor.cs
- PeerNameResolver.cs
- ConfigurationPropertyAttribute.cs
- AttachedPropertyMethodSelector.cs
- Span.cs
- TraceContextRecord.cs
- metadatamappinghashervisitor.cs
- TimersDescriptionAttribute.cs
- mansign.cs
- AlternateViewCollection.cs
- FunctionGenerator.cs
- TextRangeEdit.cs
- clipboard.cs
- ItemsControl.cs
- WebErrorHandler.cs
- PropertyOverridesTypeEditor.cs
- PipelineDeploymentState.cs
- OrderedDictionaryStateHelper.cs
- Calendar.cs
- PackWebRequest.cs
- XmlWellformedWriterHelpers.cs
- DesignerDeviceConfig.cs
- LicFileLicenseProvider.cs
- CodeAttachEventStatement.cs
- WebPartsPersonalization.cs
- mactripleDES.cs
- CryptoKeySecurity.cs
- ServiceReference.cs
- AssemblyHelper.cs
- SamlEvidence.cs
- XmlElementAttribute.cs
- PerformanceCounterPermissionAttribute.cs
- WS2007HttpBindingElement.cs
- WpfSharedBamlSchemaContext.cs
- DataGridClipboardHelper.cs
- DataGridCellClipboardEventArgs.cs
- OleDbConnectionFactory.cs
- NativeMethods.cs
- ProtectedConfiguration.cs
- SafeNativeMethods.cs
- IPHostEntry.cs
- FixedElement.cs
- DependencyPropertyDescriptor.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- GridErrorDlg.cs
- WebSysDescriptionAttribute.cs
- CompilerWrapper.cs
- RenderData.cs
- Tuple.cs
- CssStyleCollection.cs
- AssociationType.cs
- ComboBox.cs
- ComponentEditorForm.cs
- LogEntryHeaderSerializer.cs
- HtmlInputButton.cs
- CaseInsensitiveHashCodeProvider.cs
- DefaultMemberAttribute.cs
- CacheRequest.cs
- KeyTimeConverter.cs
- DataReaderContainer.cs
- CodePropertyReferenceExpression.cs
- ConfigurationCollectionAttribute.cs
- BinaryNode.cs
- XmlKeywords.cs
- XmlDataSourceView.cs
- QueuePathEditor.cs
- ObjectAnimationBase.cs
- Switch.cs
- LineSegment.cs
- MasterPageParser.cs
- DataSourceControlBuilder.cs
- MultipleViewProviderWrapper.cs
- Transform.cs
- HttpCachePolicy.cs
- PhonemeConverter.cs
- TransformerTypeCollection.cs
- CodeAttachEventStatement.cs
- ColumnMap.cs
- ToolStripDropDownButton.cs
- CapabilitiesPattern.cs
- OverflowException.cs
- NativeActivityContext.cs
- Vector3DCollection.cs
- WriteTimeStream.cs
- ReferenceEqualityComparer.cs
- GridViewDeleteEventArgs.cs
- ReachVisualSerializerAsync.cs
- ExpressionBuilderCollection.cs
- XmlReaderDelegator.cs
- XmlSerializerVersionAttribute.cs
- XPathNodeHelper.cs
- AliasedSlot.cs
- C14NUtil.cs