Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Shared / MS / Internal / Pair.cs / 1305600 / Pair.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // Description: Pair class is useful when one needs to treat a pair of objects as a singly key in a collection. // // // History: // 08/04/2005 : mleonov - Created // //--------------------------------------------------------------------------- using System; using System.Diagnostics; namespace MS.Internal { ////// Pair class is useful when one needs to treat a pair of objects as a singly key in a collection. /// Apart from providing storage and accessors, the class forwards GetHashCode and Equals to the contained objects. /// Both object are allowed to be null. /// internal class Pair { public Pair(object first, object second) { _first = first; _second = second; } public object First { get { return _first; } } public object Second { get { return _second; } } public override int GetHashCode() { return (_first == null ? 0 : _first.GetHashCode()) ^ (_second == null ? 0 : _second.GetHashCode()); } public override bool Equals(object o) { Pair other = o as Pair; return other != null && (_first != null ? _first.Equals(other._first) : other._first == null) && (_second != null ? _second.Equals(other._second) : other._second == null); } private object _first; private object _second; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CopyNamespacesAction.cs
- ListControlConvertEventArgs.cs
- ColorContext.cs
- mediapermission.cs
- Avt.cs
- HMACSHA256.cs
- TimeSpan.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- PlainXmlSerializer.cs
- HtmlDocument.cs
- DirectoryObjectSecurity.cs
- WebPartTransformerCollection.cs
- GestureRecognitionResult.cs
- PropertyCollection.cs
- PageThemeBuildProvider.cs
- TaskFormBase.cs
- TextControlDesigner.cs
- RegexCaptureCollection.cs
- UntrustedRecipientException.cs
- TypeUsage.cs
- RequestUriProcessor.cs
- SoapElementAttribute.cs
- DateRangeEvent.cs
- XmlLanguageConverter.cs
- ConfigXmlWhitespace.cs
- OracleCommand.cs
- MethodToken.cs
- QuaternionAnimation.cs
- ComNativeDescriptor.cs
- ObjectStateManagerMetadata.cs
- DrawingCollection.cs
- DesignerGeometryHelper.cs
- BindingNavigatorDesigner.cs
- HtmlFormWrapper.cs
- SQLInt64.cs
- StringDictionary.cs
- ItemsPresenter.cs
- ProcessHostMapPath.cs
- NestPullup.cs
- PreviewPrintController.cs
- OleDbCommand.cs
- EndpointNotFoundException.cs
- ToolStripItemTextRenderEventArgs.cs
- TextDecorationLocationValidation.cs
- Transform3DGroup.cs
- CodeDelegateInvokeExpression.cs
- SizeConverter.cs
- ArrangedElement.cs
- EastAsianLunisolarCalendar.cs
- UInt32.cs
- DataGridViewHitTestInfo.cs
- ButtonBase.cs
- SQLBytes.cs
- ScriptControlManager.cs
- KnownBoxes.cs
- GuidelineSet.cs
- SyndicationLink.cs
- MiniConstructorInfo.cs
- DelegateBodyWriter.cs
- TaskFileService.cs
- StorageTypeMapping.cs
- ShaderRenderModeValidation.cs
- XamlRtfConverter.cs
- TableLayoutPanelCodeDomSerializer.cs
- AsyncOperationManager.cs
- RadialGradientBrush.cs
- CollectionContainer.cs
- LinqDataView.cs
- DynamicDataRoute.cs
- DescriptionAttribute.cs
- AdditionalEntityFunctions.cs
- CommandPlan.cs
- SortableBindingList.cs
- ListBindingConverter.cs
- BaseInfoTable.cs
- LabelTarget.cs
- HtmlInputReset.cs
- Suspend.cs
- PathSegmentCollection.cs
- listitem.cs
- ContentValidator.cs
- CodeCatchClause.cs
- QuaternionConverter.cs
- StringUtil.cs
- ApplicationProxyInternal.cs
- NativeRecognizer.cs
- WebBrowserUriTypeConverter.cs
- SqlDataSourceEnumerator.cs
- DataGridState.cs
- AdornerPresentationContext.cs
- CodeChecksumPragma.cs
- DESCryptoServiceProvider.cs
- ClrPerspective.cs
- WindowsComboBox.cs
- ToolStripTextBox.cs
- SignatureConfirmationElement.cs
- ApplicationHost.cs
- AnnotationResource.cs
- AxHost.cs
- SamlSecurityTokenAuthenticator.cs