Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Util / Pair.cs / 1305376 / 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
- UmAlQuraCalendar.cs
- TransformConverter.cs
- DateTimeValueSerializer.cs
- TokenBasedSet.cs
- Attachment.cs
- WindowsButton.cs
- AsyncOperationContext.cs
- TextBoxBase.cs
- SHA1Managed.cs
- NetPeerTcpBinding.cs
- Semaphore.cs
- NetworkInformationException.cs
- MenuItemBindingCollection.cs
- XsdDateTime.cs
- CompileXomlTask.cs
- SchemaElementDecl.cs
- BodyGlyph.cs
- StylusTouchDevice.cs
- RelatedImageListAttribute.cs
- InkPresenter.cs
- XmlFormatExtensionPrefixAttribute.cs
- HelloOperationCD1AsyncResult.cs
- HelpKeywordAttribute.cs
- StackSpiller.Bindings.cs
- SoapMessage.cs
- PageCache.cs
- BaseTemplateBuildProvider.cs
- Mapping.cs
- PreProcessInputEventArgs.cs
- Assembly.cs
- webeventbuffer.cs
- SqlReorderer.cs
- ClientEventManager.cs
- KeyManager.cs
- LayoutEvent.cs
- SystemColors.cs
- DataPager.cs
- securitycriticaldataformultiplegetandset.cs
- CompilationUnit.cs
- RtfFormatStack.cs
- CodeDirectoryCompiler.cs
- Vector.cs
- SQLByte.cs
- HMACMD5.cs
- ETagAttribute.cs
- FontNamesConverter.cs
- SequenceRangeCollection.cs
- BrushConverter.cs
- CodeEventReferenceExpression.cs
- ObjectConverter.cs
- X509UI.cs
- GridToolTip.cs
- TrustLevelCollection.cs
- TextEncodedRawTextWriter.cs
- FunctionUpdateCommand.cs
- FilterInvalidBodyAccessException.cs
- AdornerDecorator.cs
- SessionStateContainer.cs
- RightsManagementEncryptedStream.cs
- MaskedTextBoxDesignerActionList.cs
- counter.cs
- TemplateBindingExpression.cs
- SQLDateTimeStorage.cs
- bindurihelper.cs
- NamespaceTable.cs
- GridViewEditEventArgs.cs
- RegexMatch.cs
- ValidatorCollection.cs
- ping.cs
- StrongName.cs
- RuntimeConfigLKG.cs
- WmlControlAdapter.cs
- WebPartConnection.cs
- ChannelTokenTypeConverter.cs
- RTLAwareMessageBox.cs
- NativeMethods.cs
- ListChangedEventArgs.cs
- BuildProvider.cs
- TableRowCollection.cs
- CopyOnWriteList.cs
- PackWebRequestFactory.cs
- ObjectConverter.cs
- SqlTriggerAttribute.cs
- KernelTypeValidation.cs
- SoapSchemaImporter.cs
- MaxMessageSizeStream.cs
- TypeExtensionConverter.cs
- Properties.cs
- FreezableCollection.cs
- PlainXmlDeserializer.cs
- Misc.cs
- InstanceDescriptor.cs
- TypeUnloadedException.cs
- ProvideValueServiceProvider.cs
- AggregatePushdown.cs
- ExpandCollapsePattern.cs
- CapabilitiesPattern.cs
- WindowsScroll.cs
- fixedPageContentExtractor.cs
- XdrBuilder.cs