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
- NavigationEventArgs.cs
- StateWorkerRequest.cs
- VisualTarget.cs
- UIElementPropertyUndoUnit.cs
- configsystem.cs
- OlePropertyStructs.cs
- ForeignConstraint.cs
- x509utils.cs
- PersonalizationDictionary.cs
- SoapServerProtocol.cs
- MarginsConverter.cs
- CanonicalXml.cs
- WSSecurityOneDotOneSendSecurityHeader.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- ZipIOModeEnforcingStream.cs
- Serializer.cs
- BindUriHelper.cs
- TransformerTypeCollection.cs
- SiteMapDataSource.cs
- EndPoint.cs
- ReservationNotFoundException.cs
- DeviceFilterEditorDialog.cs
- Brush.cs
- BindingObserver.cs
- UriParserTemplates.cs
- ProcessModuleCollection.cs
- SymmetricAlgorithm.cs
- XPathNodeList.cs
- AsyncSerializedWorker.cs
- HttpRequest.cs
- MaskedTextBox.cs
- CfgSemanticTag.cs
- XPathQilFactory.cs
- CSharpCodeProvider.cs
- XmlAttributeOverrides.cs
- MediaCommands.cs
- PerformanceCounter.cs
- WebConfigurationFileMap.cs
- PngBitmapDecoder.cs
- WindowAutomationPeer.cs
- WsrmFault.cs
- GridView.cs
- SmtpNetworkElement.cs
- SqlBooleanizer.cs
- WS2007FederationHttpBindingElement.cs
- CodeDOMUtility.cs
- Item.cs
- GiveFeedbackEvent.cs
- CharacterBuffer.cs
- OneOfTypeConst.cs
- WebCategoryAttribute.cs
- TimeoutValidationAttribute.cs
- StringBuilder.cs
- FlowDocumentView.cs
- RightsManagementInformation.cs
- MetafileHeaderWmf.cs
- ListBoxItemAutomationPeer.cs
- EventBuilder.cs
- SQLMoneyStorage.cs
- TextEffect.cs
- StringHelper.cs
- ChtmlPageAdapter.cs
- JsonCollectionDataContract.cs
- PermissionSetTriple.cs
- StaticDataManager.cs
- WebDescriptionAttribute.cs
- Emitter.cs
- SQLResource.cs
- XmlSerializationWriter.cs
- PixelShader.cs
- ThreadPool.cs
- ObjectCache.cs
- ToolStripItemCollection.cs
- Menu.cs
- EdmConstants.cs
- MetaTable.cs
- ConnectionInterfaceCollection.cs
- DashStyle.cs
- MemoryMappedView.cs
- MergeFilterQuery.cs
- ViewLoader.cs
- ColumnClickEvent.cs
- CounterSampleCalculator.cs
- ConfigXmlAttribute.cs
- ImpersonationContext.cs
- SafePointer.cs
- NotCondition.cs
- SpellerInterop.cs
- TextAdaptor.cs
- DataBoundControl.cs
- ReachFixedPageSerializerAsync.cs
- QilIterator.cs
- DocumentReferenceCollection.cs
- VisualCollection.cs
- Interlocked.cs
- XsdCachingReader.cs
- LinqDataSourceUpdateEventArgs.cs
- SymbolDocumentInfo.cs
- COM2PropertyBuilderUITypeEditor.cs
- SQLInt32.cs