Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / xsp / System / Web / Extensions / Util / Pair.cs / 2 / Pair.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Util { using System; // Generic Pair class. Overrides Equals() and GetHashCode(), so it can be used as a dictionary key. internal sealed class Pair{ private readonly TFirst _first; private readonly TSecond _second; public Pair(TFirst first, TSecond second) { _first = first; _second = second; } public TFirst First { get { return _first; } } public TSecond Second { get { return _second; } } public override bool Equals(object obj) { if (obj == this) { return true; } Pair other = obj as Pair ; return (other != null) && (((other._first == null) && (_first == null)) || ((other._first != null) && other._first.Equals(_first))) && (((other._second == null) && (_second == null)) || ((other._second != null) && other._second.Equals(_second))); } public override int GetHashCode() { int a = (_first == null) ? 0 : _first.GetHashCode(); int b = (_second == null) ? 0 : _second.GetHashCode(); return HashCodeCombiner.CombineHashCodes(a, b); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Util { using System; // Generic Pair class. Overrides Equals() and GetHashCode(), so it can be used as a dictionary key. internal sealed class Pair{ private readonly TFirst _first; private readonly TSecond _second; public Pair(TFirst first, TSecond second) { _first = first; _second = second; } public TFirst First { get { return _first; } } public TSecond Second { get { return _second; } } public override bool Equals(object obj) { if (obj == this) { return true; } Pair other = obj as Pair ; return (other != null) && (((other._first == null) && (_first == null)) || ((other._first != null) && other._first.Equals(_first))) && (((other._second == null) && (_second == null)) || ((other._second != null) && other._second.Equals(_second))); } public override int GetHashCode() { int a = (_first == null) ? 0 : _first.GetHashCode(); int b = (_second == null) ? 0 : _second.GetHashCode(); return HashCodeCombiner.CombineHashCodes(a, b); } } } // 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
- Number.cs
- ThreadStateException.cs
- SafeFileMapViewHandle.cs
- AsyncStreamReader.cs
- ITextView.cs
- X509ClientCertificateCredentialsElement.cs
- StylusOverProperty.cs
- DataControlFieldCell.cs
- SvcMapFile.cs
- CroppedBitmap.cs
- TypeSystemProvider.cs
- DateTimeSerializationSection.cs
- MetafileHeader.cs
- RowVisual.cs
- XmlCharType.cs
- MachineKeyConverter.cs
- _DigestClient.cs
- DateTimeFormat.cs
- OlePropertyStructs.cs
- XmlSchemaExporter.cs
- FlowDocumentReaderAutomationPeer.cs
- EmbossBitmapEffect.cs
- WaitHandleCannotBeOpenedException.cs
- ProtocolProfile.cs
- _DomainName.cs
- DataGridViewSelectedRowCollection.cs
- SqlMetaData.cs
- ScriptingJsonSerializationSection.cs
- List.cs
- LocalizationComments.cs
- DefaultValueAttribute.cs
- ManagedIStream.cs
- securitycriticaldataformultiplegetandset.cs
- ActionItem.cs
- LocalizabilityAttribute.cs
- ContextDataSource.cs
- WebResourceUtil.cs
- RangeBase.cs
- ContentValidator.cs
- PtsContext.cs
- GenerateTemporaryTargetAssembly.cs
- ButtonFlatAdapter.cs
- RegexCaptureCollection.cs
- DataRecord.cs
- OrderedDictionaryStateHelper.cs
- PropertyGridView.cs
- DataGridHyperlinkColumn.cs
- SafeLibraryHandle.cs
- ValueConversionAttribute.cs
- XmlILIndex.cs
- TypeNameConverter.cs
- SqlUnionizer.cs
- TextEncodedRawTextWriter.cs
- DictionarySectionHandler.cs
- SendMessageChannelCache.cs
- TransactionProtocol.cs
- Simplifier.cs
- StrongName.cs
- DataGridToolTip.cs
- TimeStampChecker.cs
- ToolStripButton.cs
- MemberDescriptor.cs
- ToolStripPanelRow.cs
- ReliableMessagingVersionConverter.cs
- ToolStripItemEventArgs.cs
- ListViewItemSelectionChangedEvent.cs
- Environment.cs
- EndpointIdentityExtension.cs
- MarkupObject.cs
- Attachment.cs
- SystemSounds.cs
- Misc.cs
- DataGridPagerStyle.cs
- Facet.cs
- RunClient.cs
- XPathBinder.cs
- TripleDES.cs
- StrokeCollection.cs
- AutomationPropertyInfo.cs
- FrameworkTemplate.cs
- Utilities.cs
- CroppedBitmap.cs
- ValidatingCollection.cs
- Vector3DIndependentAnimationStorage.cs
- DesignerActionUIStateChangeEventArgs.cs
- TaiwanLunisolarCalendar.cs
- HttpRawResponse.cs
- HitTestFilterBehavior.cs
- WebAdminConfigurationHelper.cs
- UserPersonalizationStateInfo.cs
- WorkflowRuntimeServiceElement.cs
- CodeMethodReturnStatement.cs
- InvalidFilterCriteriaException.cs
- EdmEntityTypeAttribute.cs
- TextReader.cs
- RelationshipConstraintValidator.cs
- LassoSelectionBehavior.cs
- PreviewPrintController.cs
- HwndTarget.cs
- Renderer.cs