Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Misc / CompatibleIComparer.cs / 1305376 / CompatibleIComparer.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * This class is used to create hashcodes that are Everett Compatible. * * Copyright (c) 2004 Microsoft Corporation */ namespace System.Collections.Specialized { using Microsoft.Win32; using System.Collections; using System.Runtime.Serialization; using System.Globalization; internal class BackCompatibleStringComparer : IEqualityComparer { static internal IEqualityComparer Default = new BackCompatibleStringComparer(); internal BackCompatibleStringComparer() { } //This comes from VS# 434837 and is specifically written to get backcompat public static int GetHashCode(string obj) { unsafe { fixed (char* src = obj) { int hash = 5381; int c; char* szStr = src; while ((c = *szStr) != 0) { hash = ((hash << 5) + hash) ^ c; ++szStr; } return hash; } } } bool IEqualityComparer.Equals(Object a, Object b) { return Object.Equals(a, b); } public virtual int GetHashCode(Object o) { String obj = o as string; if (obj == null) { return o.GetHashCode(); } return BackCompatibleStringComparer.GetHashCode(obj); } } } // 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
- Stack.cs
- UidManager.cs
- HttpEncoderUtility.cs
- CodeTypeMemberCollection.cs
- ListControlConvertEventArgs.cs
- SemaphoreSlim.cs
- ViewPort3D.cs
- KeyEvent.cs
- ToolStripInSituService.cs
- EntityProxyFactory.cs
- BinaryNode.cs
- PrimitiveSchema.cs
- ZoneIdentityPermission.cs
- Types.cs
- FacetDescription.cs
- AncestorChangedEventArgs.cs
- _AutoWebProxyScriptEngine.cs
- PageSettings.cs
- SelectionEditingBehavior.cs
- ResolvedKeyFrameEntry.cs
- JsonFormatGeneratorStatics.cs
- ByteRangeDownloader.cs
- Menu.cs
- RawKeyboardInputReport.cs
- IsolatedStorage.cs
- EntityDataSourceContextCreatingEventArgs.cs
- InvalidPipelineStoreException.cs
- TextBoxAutomationPeer.cs
- Viewport3DAutomationPeer.cs
- NullReferenceException.cs
- MULTI_QI.cs
- OdbcCommandBuilder.cs
- EmptyControlCollection.cs
- PerformanceCounterCategory.cs
- ReferentialConstraintRoleElement.cs
- XmlBoundElement.cs
- COAUTHINFO.cs
- SelectedGridItemChangedEvent.cs
- MetabaseSettingsIis7.cs
- ColorIndependentAnimationStorage.cs
- Effect.cs
- ArgumentNullException.cs
- CompilerState.cs
- JsonQNameDataContract.cs
- DocobjHost.cs
- Evidence.cs
- WebPartCatalogCloseVerb.cs
- SimplePropertyEntry.cs
- ZipIOFileItemStream.cs
- SqlException.cs
- RowsCopiedEventArgs.cs
- ExpressionConverter.cs
- ItemsControlAutomationPeer.cs
- UpdateProgress.cs
- WebPartHelpVerb.cs
- MessageHeaderInfoTraceRecord.cs
- SharingService.cs
- Parameter.cs
- HttpException.cs
- OdbcRowUpdatingEvent.cs
- RoleManagerEventArgs.cs
- ConversionContext.cs
- CompiledRegexRunnerFactory.cs
- XmlDataCollection.cs
- GlyphsSerializer.cs
- SessionParameter.cs
- HostedNamedPipeTransportManager.cs
- CheckedListBox.cs
- AuthenticationSchemesHelper.cs
- PrintDialog.cs
- DomainConstraint.cs
- PinnedBufferMemoryStream.cs
- ArithmeticException.cs
- DelegatingMessage.cs
- WebPartManagerInternals.cs
- SelectionPattern.cs
- ComponentGuaranteesAttribute.cs
- AmbiguousMatchException.cs
- DocumentXmlWriter.cs
- SecurityDocument.cs
- DataGridViewButtonCell.cs
- shaperfactory.cs
- WebPartPersonalization.cs
- SolidBrush.cs
- DataGridViewComboBoxCell.cs
- ActivityExecutor.cs
- ShapingEngine.cs
- CachedTypeface.cs
- WebServiceMethodData.cs
- ChameleonKey.cs
- GenericEnumerator.cs
- CommonProperties.cs
- HttpCacheVary.cs
- WebServiceTypeData.cs
- PixelFormats.cs
- StoreContentChangedEventArgs.cs
- LocalizeDesigner.cs
- OperationResponse.cs
- ArgumentOutOfRangeException.cs
- XmlSchemaDatatype.cs