Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Misc / CompatibleIComparer.cs / 1 / 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. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MsmqIntegrationElement.cs
- CodeGenerator.cs
- CookieHandler.cs
- DataRelation.cs
- SQLRoleProvider.cs
- DNS.cs
- SqlCacheDependencyDatabase.cs
- Membership.cs
- RoleService.cs
- RoleGroupCollection.cs
- LinkClickEvent.cs
- ImageAutomationPeer.cs
- Translator.cs
- ByteRangeDownloader.cs
- AuthorizationRuleCollection.cs
- PrintDialogException.cs
- WebPartEditVerb.cs
- TableLayoutStyle.cs
- RequestCachingSection.cs
- ThousandthOfEmRealDoubles.cs
- PLINQETWProvider.cs
- documentsequencetextview.cs
- FillRuleValidation.cs
- TraceSection.cs
- ObjectHandle.cs
- AuthorizationRule.cs
- SerializationException.cs
- infer.cs
- TargetException.cs
- DataGridViewComboBoxCell.cs
- ConnectivityStatus.cs
- IdentityNotMappedException.cs
- RenderContext.cs
- DllNotFoundException.cs
- ToolStripRenderer.cs
- EncodingNLS.cs
- EncodingConverter.cs
- EllipseGeometry.cs
- RoamingStoreFile.cs
- RequestQueue.cs
- BamlStream.cs
- CatalogZoneBase.cs
- ImageDrawing.cs
- SqlConnectionHelper.cs
- LocatorPart.cs
- Privilege.cs
- XsltLibrary.cs
- SystemEvents.cs
- ExcludePathInfo.cs
- WebPartUserCapability.cs
- WebColorConverter.cs
- ErrorLog.cs
- UTF32Encoding.cs
- AssemblyAttributesGoHere.cs
- StorageMappingItemCollection.cs
- InputDevice.cs
- ISFClipboardData.cs
- CodeTypeParameterCollection.cs
- listitem.cs
- LinkConverter.cs
- IPipelineRuntime.cs
- OutputCacheSettings.cs
- SerializationStore.cs
- FontWeight.cs
- TemplateBindingExpression.cs
- DatatypeImplementation.cs
- DockPattern.cs
- RegexStringValidatorAttribute.cs
- DataList.cs
- FileEnumerator.cs
- TabletDevice.cs
- MetafileHeader.cs
- SerialErrors.cs
- CustomWebEventKey.cs
- Timer.cs
- TextTreeNode.cs
- XmlSchema.cs
- Odbc32.cs
- CatalogPartChrome.cs
- OverflowException.cs
- EnumerableCollectionView.cs
- RootBuilder.cs
- peernodestatemanager.cs
- ScrollEventArgs.cs
- ClientSettingsProvider.cs
- AssociationSet.cs
- Property.cs
- LocalValueEnumerator.cs
- GenericUriParser.cs
- ComponentResourceManager.cs
- XPathDocumentIterator.cs
- SourceFileBuildProvider.cs
- QuaternionKeyFrameCollection.cs
- EqualityArray.cs
- ContentHostHelper.cs
- EventProvider.cs
- DataTableMapping.cs
- DragCompletedEventArgs.cs
- IntSecurity.cs
- BroadcastEventHelper.cs