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
- WebPartsPersonalization.cs
- LayoutEvent.cs
- BaseParser.cs
- SystemParameters.cs
- Point3DConverter.cs
- IPipelineRuntime.cs
- SiteMembershipCondition.cs
- ClientData.cs
- Clock.cs
- UrlAuthorizationModule.cs
- TextTabProperties.cs
- TemplateXamlTreeBuilder.cs
- CustomAssemblyResolver.cs
- FormsAuthenticationUser.cs
- HostingEnvironment.cs
- ExpressionBindings.cs
- ResourceManagerWrapper.cs
- FrameworkTextComposition.cs
- RouteItem.cs
- SqlProviderServices.cs
- PeerNameRegistration.cs
- ResponseStream.cs
- TypedElement.cs
- XslNumber.cs
- Stroke2.cs
- XmlBinaryReaderSession.cs
- App.cs
- ipaddressinformationcollection.cs
- ScriptControlDescriptor.cs
- SrgsElementFactoryCompiler.cs
- AnnotationComponentChooser.cs
- QueryContinueDragEvent.cs
- CompilationPass2Task.cs
- CustomWebEventKey.cs
- FlowDocumentReaderAutomationPeer.cs
- SqlCaseSimplifier.cs
- CodeDomDesignerLoader.cs
- XamlSerializer.cs
- TreeNode.cs
- NullableDecimalMinMaxAggregationOperator.cs
- ExpressionParser.cs
- SoapSchemaExporter.cs
- CompilationLock.cs
- HtmlInputControl.cs
- AutomationIdentifier.cs
- MergeFailedEvent.cs
- FontNamesConverter.cs
- StrokeCollection2.cs
- TextOutput.cs
- ClientSettings.cs
- ByteAnimationBase.cs
- XmlName.cs
- ServiceProviders.cs
- ResourceReferenceExpressionConverter.cs
- Span.cs
- GridViewUpdatedEventArgs.cs
- CoreSwitches.cs
- TreeViewImageKeyConverter.cs
- Pair.cs
- DescriptionAttribute.cs
- PropertyIDSet.cs
- VectorConverter.cs
- DataGridViewCellParsingEventArgs.cs
- EdmType.cs
- FunctionImportElement.cs
- DataFieldConverter.cs
- SqlBooleanizer.cs
- CachedTypeface.cs
- PrivateFontCollection.cs
- WebSysDefaultValueAttribute.cs
- PropertyIdentifier.cs
- MaskInputRejectedEventArgs.cs
- CompilerInfo.cs
- WindowProviderWrapper.cs
- UrlParameterWriter.cs
- StyleHelper.cs
- ExtentKey.cs
- SubMenuStyleCollection.cs
- ExceptionUtil.cs
- IsolationInterop.cs
- TraceEventCache.cs
- DirectoryNotFoundException.cs
- OrCondition.cs
- AssemblySettingAttributes.cs
- ListItemCollection.cs
- WebPartConnectionsDisconnectVerb.cs
- PathSegmentCollection.cs
- WebPartConnectionsEventArgs.cs
- diagnosticsswitches.cs
- bidPrivateBase.cs
- IMembershipProvider.cs
- WindowsComboBox.cs
- LineServicesRun.cs
- DrawingContextDrawingContextWalker.cs
- DataGridViewColumnConverter.cs
- GregorianCalendar.cs
- XmlObjectSerializerWriteContextComplex.cs
- DataList.cs
- WebServiceEndpoint.cs
- ParsedAttributeCollection.cs