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
- DelegatingConfigHost.cs
- Rule.cs
- MailMessage.cs
- SqlUserDefinedTypeAttribute.cs
- CorrelationTokenTypeConvertor.cs
- QuaternionRotation3D.cs
- SafeSecurityHandles.cs
- ConfigurationSectionCollection.cs
- DataGridViewCell.cs
- Binding.cs
- StdRegProviderWrapper.cs
- WebPartCollection.cs
- ShaperBuffers.cs
- TargetControlTypeCache.cs
- CommandConverter.cs
- DataControlFieldCell.cs
- RemoteCryptoTokenProvider.cs
- loginstatus.cs
- RegexWorker.cs
- PerformanceCounterNameAttribute.cs
- WindowsTab.cs
- WebPartTransformerAttribute.cs
- WebDescriptionAttribute.cs
- StyleHelper.cs
- CounterSampleCalculator.cs
- CatalogZone.cs
- GraphicsState.cs
- DependencyPropertyConverter.cs
- AttributeQuery.cs
- HashCodeCombiner.cs
- XamlReaderHelper.cs
- ErrorWebPart.cs
- InfoCardMetadataExchangeClient.cs
- HtmlInputHidden.cs
- MatrixUtil.cs
- ObjectConverter.cs
- SiteMapDataSource.cs
- ListView.cs
- ExpressionVisitor.cs
- NotifyIcon.cs
- MenuCommandService.cs
- SmiEventSink_DeferedProcessing.cs
- VirtualPathUtility.cs
- PolicyStatement.cs
- CodeGenerator.cs
- _CacheStreams.cs
- EventDescriptorCollection.cs
- QueryOutputWriter.cs
- BamlRecordReader.cs
- odbcmetadatacolumnnames.cs
- EntityDataSourceColumn.cs
- HeaderedItemsControl.cs
- SQLString.cs
- ContextQuery.cs
- SymbolResolver.cs
- EdmSchemaError.cs
- ResourceBinder.cs
- RadioButtonStandardAdapter.cs
- Int32CollectionValueSerializer.cs
- CodeDirectiveCollection.cs
- RouteUrlExpressionBuilder.cs
- SendMessageRecord.cs
- Selection.cs
- DirectoryNotFoundException.cs
- RegexCompiler.cs
- PathFigureCollectionValueSerializer.cs
- PartialCachingControl.cs
- OrderByBuilder.cs
- TextOnlyOutput.cs
- PingReply.cs
- ConnectionPoint.cs
- GroupBox.cs
- XamlClipboardData.cs
- BlurEffect.cs
- XmlSerializerSection.cs
- Pkcs9Attribute.cs
- ZoneLinkButton.cs
- WorkflowQueue.cs
- TreeViewItemAutomationPeer.cs
- ValueTypeIndexerReference.cs
- PromptStyle.cs
- WinInetCache.cs
- WebCategoryAttribute.cs
- SecureUICommand.cs
- BaseHashHelper.cs
- wgx_render.cs
- FileEnumerator.cs
- TreeNodeBindingCollection.cs
- TagElement.cs
- TagElement.cs
- PersonalizationDictionary.cs
- PartialList.cs
- MsmqIntegrationProcessProtocolHandler.cs
- XmlDataContract.cs
- ConfigUtil.cs
- HwndSubclass.cs
- Compiler.cs
- ECDiffieHellman.cs
- DataGridViewCellStateChangedEventArgs.cs
- StrokeCollectionConverter.cs