Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- RSAPKCS1KeyExchangeFormatter.cs
- EntryWrittenEventArgs.cs
- CatalogZone.cs
- HtmlTableRowCollection.cs
- XmlConvert.cs
- AndCondition.cs
- CodeDelegateInvokeExpression.cs
- ObjectDisposedException.cs
- Viewport2DVisual3D.cs
- UntrustedRecipientException.cs
- MsdtcWrapper.cs
- LocalizableResourceBuilder.cs
- Ticks.cs
- CaseCqlBlock.cs
- SimpleColumnProvider.cs
- assemblycache.cs
- OpCopier.cs
- MenuItem.cs
- DockAndAnchorLayout.cs
- DbParameterCollectionHelper.cs
- XhtmlBasicFormAdapter.cs
- XamlSerializerUtil.cs
- NativeWindow.cs
- BinaryObjectWriter.cs
- SoapTransportImporter.cs
- EventProviderWriter.cs
- BitmapSizeOptions.cs
- _CommandStream.cs
- Variant.cs
- SymLanguageType.cs
- DataTableMapping.cs
- WebHttpBindingElement.cs
- ActivitiesCollection.cs
- XmlSchemaInfo.cs
- Expression.cs
- CacheChildrenQuery.cs
- ColumnBinding.cs
- DesignerOptionService.cs
- ConfigurationManager.cs
- EntityDataSourceDataSelectionPanel.cs
- DbProviderSpecificTypePropertyAttribute.cs
- CancelEventArgs.cs
- WizardForm.cs
- SafeSecurityHandles.cs
- StreamMarshaler.cs
- OracleTransaction.cs
- MetaTableHelper.cs
- XmlSiteMapProvider.cs
- DnsPermission.cs
- SerializeAbsoluteContext.cs
- Base64Decoder.cs
- HttpProcessUtility.cs
- QueryContinueDragEvent.cs
- OneOf.cs
- MatrixTransform3D.cs
- EndPoint.cs
- HwndTarget.cs
- ReturnType.cs
- CollectionBuilder.cs
- MultipleViewProviderWrapper.cs
- PageContentCollection.cs
- TreeViewImageIndexConverter.cs
- ParsedAttributeCollection.cs
- GroupStyle.cs
- SettingsAttributeDictionary.cs
- HostingMessageProperty.cs
- precedingquery.cs
- PrintControllerWithStatusDialog.cs
- DeflateStream.cs
- EntityStoreSchemaFilterEntry.cs
- TextPointerBase.cs
- MapPathBasedVirtualPathProvider.cs
- Literal.cs
- WorkflowServiceHostFactory.cs
- ReadWriteObjectLock.cs
- WCFModelStrings.Designer.cs
- OleDbDataAdapter.cs
- ColumnPropertiesGroup.cs
- HttpHandlersSection.cs
- XmlLanguage.cs
- CodeTypeDeclarationCollection.cs
- CommentEmitter.cs
- DefaultAsyncDataDispatcher.cs
- CustomError.cs
- SqlCharStream.cs
- TextEditorSpelling.cs
- Window.cs
- _OSSOCK.cs
- DataGridCellClipboardEventArgs.cs
- EditorPartDesigner.cs
- AssociationTypeEmitter.cs
- UpDownEvent.cs
- ErrorFormatterPage.cs
- ComponentResourceKey.cs
- XamlParser.cs
- PackageProperties.cs
- SqlInfoMessageEvent.cs
- BindingCompleteEventArgs.cs
- SqlLiftIndependentRowExpressions.cs
- DocumentPage.cs