Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- ActivityExecutionContext.cs
- hresults.cs
- QilCloneVisitor.cs
- Label.cs
- EncoderReplacementFallback.cs
- BindingsCollection.cs
- CompressionTracing.cs
- HwndKeyboardInputProvider.cs
- PreloadedPackages.cs
- SchemaInfo.cs
- ExpressionTextBoxAutomationPeer.cs
- Missing.cs
- ActiveXHost.cs
- GeneralTransform3DTo2D.cs
- SourceItem.cs
- NotImplementedException.cs
- EFAssociationProvider.cs
- TypeListConverter.cs
- HttpGetClientProtocol.cs
- LineVisual.cs
- DataGridClipboardHelper.cs
- SingletonInstanceContextProvider.cs
- Int32.cs
- HttpServerVarsCollection.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- BindableAttribute.cs
- RegexStringValidatorAttribute.cs
- Pair.cs
- EntityProxyTypeInfo.cs
- Int64KeyFrameCollection.cs
- DocumentViewerBase.cs
- DbgUtil.cs
- DataViewSettingCollection.cs
- __Error.cs
- OdbcException.cs
- Memoizer.cs
- SqlRowUpdatingEvent.cs
- WsrmTraceRecord.cs
- Accessible.cs
- MessageQueueException.cs
- HttpEncoder.cs
- ByteStreamMessageEncodingElement.cs
- LocatorPartList.cs
- NumberFormatter.cs
- CodePrimitiveExpression.cs
- IUnknownConstantAttribute.cs
- BackgroundWorker.cs
- DynamicControl.cs
- FrameworkTextComposition.cs
- DoubleLink.cs
- ClonableStack.cs
- OletxTransactionManager.cs
- GeneratedCodeAttribute.cs
- AsyncParams.cs
- ByteStorage.cs
- Argument.cs
- DebuggerAttributes.cs
- TemplateParser.cs
- WhitespaceRuleReader.cs
- SerializeAbsoluteContext.cs
- OdbcPermission.cs
- RadioButton.cs
- XsdCachingReader.cs
- X509CertificateCollection.cs
- XmlCustomFormatter.cs
- ContextInformation.cs
- CodeParameterDeclarationExpressionCollection.cs
- Calendar.cs
- RecommendedAsConfigurableAttribute.cs
- Number.cs
- XmlNamedNodeMap.cs
- MimeAnyImporter.cs
- Utils.cs
- GridViewSortEventArgs.cs
- SymLanguageVendor.cs
- TableSectionStyle.cs
- PointLight.cs
- DbParameterCollectionHelper.cs
- XsltCompileContext.cs
- BuilderPropertyEntry.cs
- BitFlagsGenerator.cs
- NameValueFileSectionHandler.cs
- InstalledVoice.cs
- ManifestResourceInfo.cs
- FontNamesConverter.cs
- GridLength.cs
- NativeMethods.cs
- DateTimeConverter.cs
- WindowsAuthenticationModule.cs
- WebPartEditorOkVerb.cs
- ExpandableObjectConverter.cs
- FileVersionInfo.cs
- EncryptedKeyIdentifierClause.cs
- ToolStripItemBehavior.cs
- ClientUtils.cs
- PolicyManager.cs
- UInt32Storage.cs
- CornerRadius.cs
- ToolStripDropDownClosedEventArgs.cs
- BitmapCodecInfo.cs