Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- TreeViewItemAutomationPeer.cs
- AssertSection.cs
- WSAddressing10ProblemHeaderQNameFault.cs
- SQLChars.cs
- GlyphingCache.cs
- WinCategoryAttribute.cs
- SoapRpcMethodAttribute.cs
- CaseKeyBox.ViewModel.cs
- XmlQualifiedName.cs
- DBPropSet.cs
- DescendentsWalkerBase.cs
- TreeBuilderBamlTranslator.cs
- ListViewEditEventArgs.cs
- Code.cs
- Stackframe.cs
- ReadOnlyTernaryTree.cs
- TemplateControl.cs
- OdbcConnectionStringbuilder.cs
- CodeAccessPermission.cs
- DesignerActionList.cs
- FormatConvertedBitmap.cs
- DataControlFieldCell.cs
- DataGridViewButtonColumn.cs
- SelectionItemProviderWrapper.cs
- RadioButtonList.cs
- XmlAttributeCollection.cs
- Container.cs
- Dictionary.cs
- MouseCaptureWithinProperty.cs
- Window.cs
- ProcessThread.cs
- DataGridViewRowStateChangedEventArgs.cs
- RoutedUICommand.cs
- QuaternionValueSerializer.cs
- ADMembershipUser.cs
- RemoteWebConfigurationHostServer.cs
- TextContainerHelper.cs
- ServiceModelEnumValidator.cs
- NamedPermissionSet.cs
- Evidence.cs
- EdmError.cs
- MatrixAnimationUsingPath.cs
- PngBitmapDecoder.cs
- BaseServiceProvider.cs
- CatalogZone.cs
- RadioButtonStandardAdapter.cs
- TransformedBitmap.cs
- ClientScriptItemCollection.cs
- dataobject.cs
- ObjectDataSource.cs
- ColorInterpolationModeValidation.cs
- Table.cs
- PeerCredentialElement.cs
- EventSchemaTraceListener.cs
- ClientSettings.cs
- PropertyGridView.cs
- AsyncOperation.cs
- SafeHandle.cs
- WebPartActionVerb.cs
- TdsParserStaticMethods.cs
- HwndTarget.cs
- TextSpanModifier.cs
- Subordinate.cs
- AmbientEnvironment.cs
- ToolTipService.cs
- RuntimeResourceSet.cs
- SRef.cs
- TransformGroup.cs
- CapabilitiesRule.cs
- Variant.cs
- ManualResetEvent.cs
- DataGridViewRowConverter.cs
- ScriptDescriptor.cs
- BaseCodePageEncoding.cs
- PrimaryKeyTypeConverter.cs
- mansign.cs
- ReferencedType.cs
- MessageContractExporter.cs
- ListViewItemSelectionChangedEvent.cs
- BindingEditor.xaml.cs
- ExtendedPropertyCollection.cs
- BitmapEffectRenderDataResource.cs
- Deserializer.cs
- HttpProxyCredentialType.cs
- DisplayMemberTemplateSelector.cs
- ContentFileHelper.cs
- LocalizationCodeDomSerializer.cs
- DbFunctionCommandTree.cs
- ChannelManager.cs
- DynamicValidatorEventArgs.cs
- BamlLocalizableResource.cs
- CommandDevice.cs
- SqlErrorCollection.cs
- MediaContext.cs
- UnsafeNativeMethods.cs
- UntypedNullExpression.cs
- ReachPrintTicketSerializer.cs
- ImageIndexConverter.cs
- XPathPatternParser.cs
- TextMetrics.cs