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
- TemplateControlCodeDomTreeGenerator.cs
- UriTemplateQueryValue.cs
- Properties.cs
- NativeWindow.cs
- WindowsButton.cs
- ButtonBase.cs
- PasswordPropertyTextAttribute.cs
- CommandField.cs
- EntityDataSourceStatementEditor.cs
- Crc32.cs
- SignatureDescription.cs
- RangeValidator.cs
- TypeUtils.cs
- BindingCompleteEventArgs.cs
- Decimal.cs
- HtmlHead.cs
- FilteredSchemaElementLookUpTable.cs
- WebBrowserPermission.cs
- EmptyCollection.cs
- ClientSideQueueItem.cs
- Models.cs
- StatusBar.cs
- CqlGenerator.cs
- SqlDataSourceView.cs
- DocumentXmlWriter.cs
- SuppressMessageAttribute.cs
- InstanceData.cs
- _NegoStream.cs
- ToolStripGrip.cs
- DiscardableAttribute.cs
- SQLDecimalStorage.cs
- WorkflowCompensationBehavior.cs
- TableRow.cs
- TableParagraph.cs
- DefaultAuthorizationContext.cs
- SimpleWorkerRequest.cs
- JumpPath.cs
- Oid.cs
- X509ClientCertificateAuthenticationElement.cs
- SByte.cs
- HttpResponseHeader.cs
- VirtualDirectoryMapping.cs
- RuntimeHandles.cs
- FixedSOMContainer.cs
- WaitHandleCannotBeOpenedException.cs
- ImagingCache.cs
- SoapFormatter.cs
- IgnoreFlushAndCloseStream.cs
- TransactionFlowBindingElementImporter.cs
- WebPartVerbCollection.cs
- ConnectionConsumerAttribute.cs
- MDIWindowDialog.cs
- ReadOnlyDataSource.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- SqlMethods.cs
- BitmapEncoder.cs
- RectangleGeometry.cs
- SQLGuid.cs
- COM2IPerPropertyBrowsingHandler.cs
- LineBreakRecord.cs
- SemanticKeyElement.cs
- CultureTable.cs
- OleDbConnectionFactory.cs
- SafeNativeMethods.cs
- Array.cs
- MediaTimeline.cs
- SudsCommon.cs
- SQLByte.cs
- FixedSOMPageElement.cs
- EntityDataSourceConfigureObjectContext.cs
- CodeDefaultValueExpression.cs
- Point4D.cs
- MethodExpression.cs
- DynamicMetaObjectBinder.cs
- EntityDataSourceWrapper.cs
- RawStylusInputCustomData.cs
- Setter.cs
- InputGestureCollection.cs
- Executor.cs
- ReflectionPermission.cs
- BufferModesCollection.cs
- DbParameterCollectionHelper.cs
- CodeSnippetStatement.cs
- Group.cs
- InputLanguageEventArgs.cs
- OpenTypeLayout.cs
- TrackPoint.cs
- DelimitedListTraceListener.cs
- __Error.cs
- AssertUtility.cs
- WrapPanel.cs
- COM2IDispatchConverter.cs
- Cursors.cs
- InvalidWMPVersionException.cs
- EncryptedKey.cs
- Partitioner.cs
- IsolatedStorageFile.cs
- SizeValueSerializer.cs
- HtmlEncodedRawTextWriter.cs
- TypeExtensionConverter.cs