Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / ndp / fx / src / xsp / System / Web / Extensions / Util / Tuple.cs / 1 / Tuple.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Util {
using System;
internal sealed class Tuple {
private object[] _items;
public Tuple(params object[] items) {
_items = items;
}
public object this[int index] {
get {
return _items[index];
}
}
public override int GetHashCode() {
if (_items.Length == 0) return 0;
// This is the algorithm used in Whidbey to combine hashcodes.
// It adheres better than a simple XOR to the randomness requirement for hashcodes.
int hash = _items[0].GetHashCode();
for (int i = 1; i < _items.Length; i++) {
hash = HashCodeCombiner.CombineHashCodes(hash, _items[i].GetHashCode());
}
return hash;
}
public override bool Equals(object obj) {
if (obj == null) return false;
Tuple other = (Tuple)obj;
if (other == this) return true;
if ((other._items.Length != _items.Length)) return false;
for (int i = 0; i < _items.Length; i++) {
if (!other[i].Equals(this[i])) return false;
}
return true;
}
}
}
// 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
- TextureBrush.cs
- AnnouncementService.cs
- DynamicPropertyHolder.cs
- EdmRelationshipRoleAttribute.cs
- entityreference_tresulttype.cs
- QuaternionRotation3D.cs
- DataTableNewRowEvent.cs
- ElementInit.cs
- TextEditorDragDrop.cs
- MatrixTransform3D.cs
- XhtmlBasicValidationSummaryAdapter.cs
- ImageButton.cs
- SimpleType.cs
- TrustLevel.cs
- TailPinnedEventArgs.cs
- Environment.cs
- Char.cs
- EntitySet.cs
- FloaterBaseParagraph.cs
- TextSearch.cs
- PointUtil.cs
- RangeValueProviderWrapper.cs
- TextEditorDragDrop.cs
- RawTextInputReport.cs
- Byte.cs
- NumericUpDown.cs
- ZipIOExtraField.cs
- Wizard.cs
- InternalConfigRoot.cs
- FilterableAttribute.cs
- NetCodeGroup.cs
- Substitution.cs
- ReadOnlyTernaryTree.cs
- TableParaClient.cs
- FontUnitConverter.cs
- SystemIcmpV6Statistics.cs
- ChangePasswordDesigner.cs
- OpacityConverter.cs
- ToolStripTextBox.cs
- UriTemplate.cs
- ControlIdConverter.cs
- WebHostedComPlusServiceHost.cs
- ContentDisposition.cs
- DragCompletedEventArgs.cs
- InvalidCommandTreeException.cs
- TextEditorParagraphs.cs
- DataGrid.cs
- PriorityQueue.cs
- InputBinding.cs
- DataListItem.cs
- FormatVersion.cs
- GACIdentityPermission.cs
- MemberMaps.cs
- SqlCacheDependencySection.cs
- DataBoundControlDesigner.cs
- FixedPageStructure.cs
- PeerTransportElement.cs
- WindowsBrush.cs
- ZipPackage.cs
- PointCollection.cs
- RowToFieldTransformer.cs
- SqlParameterCollection.cs
- GridItemCollection.cs
- Convert.cs
- Serializer.cs
- SurrogateSelector.cs
- TextBoxDesigner.cs
- ComponentDesigner.cs
- SoapInteropTypes.cs
- NativeMethods.cs
- HuffmanTree.cs
- NetworkInterface.cs
- ScriptResourceDefinition.cs
- EnumerableCollectionView.cs
- BitmapPalettes.cs
- Vector3DCollectionConverter.cs
- HttpWrapper.cs
- SqlDataSourceSelectingEventArgs.cs
- SingleTagSectionHandler.cs
- SecurityHelper.cs
- PropertyMapper.cs
- WizardPanel.cs
- ComponentCommands.cs
- ExclusiveHandle.cs
- DetailsViewRowCollection.cs
- TraceContextRecord.cs
- ServiceTimeoutsElement.cs
- Int32EqualityComparer.cs
- TypeDescriptionProviderAttribute.cs
- BufferedGraphicsContext.cs
- OpCellTreeNode.cs
- Compiler.cs
- XmlSchemaSubstitutionGroup.cs
- DataTableMappingCollection.cs
- CodeAttachEventStatement.cs
- TraceRecords.cs
- PagePropertiesChangingEventArgs.cs
- DataTemplateKey.cs
- ConfigurationErrorsException.cs
- GridViewPageEventArgs.cs