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
- BrowserCapabilitiesCodeGenerator.cs
- LockedAssemblyCache.cs
- UpdateRecord.cs
- SizeValueSerializer.cs
- ToolBarOverflowPanel.cs
- BoundColumn.cs
- InvalidDataException.cs
- ToolStripDropDownItem.cs
- _FixedSizeReader.cs
- SqlResolver.cs
- PersonalizationAdministration.cs
- AuthorizationContext.cs
- ThrowOnMultipleAssignment.cs
- KerberosSecurityTokenParameters.cs
- BuildResultCache.cs
- ClrProviderManifest.cs
- WebUtil.cs
- EdmToObjectNamespaceMap.cs
- WindowsSolidBrush.cs
- ContextToken.cs
- FormatVersion.cs
- InfoCardXmlSerializer.cs
- ButtonStandardAdapter.cs
- __ComObject.cs
- WorkflowQueueInfo.cs
- IImplicitResourceProvider.cs
- TreeNode.cs
- DiscoveryEndpoint.cs
- PKCS1MaskGenerationMethod.cs
- xsdvalidator.cs
- DataServiceResponse.cs
- SqlAliaser.cs
- MappingModelBuildProvider.cs
- ValueQuery.cs
- InternalUserCancelledException.cs
- CatalogPartChrome.cs
- EventSinkActivityDesigner.cs
- BindStream.cs
- CompiledAction.cs
- Control.cs
- MSAAEventDispatcher.cs
- latinshape.cs
- CustomValidator.cs
- OutputCacheSettingsSection.cs
- PassportAuthenticationEventArgs.cs
- PassportAuthentication.cs
- WebPartConnectionsCloseVerb.cs
- ErrorFormatterPage.cs
- FileDialogCustomPlace.cs
- FunctionImportMapping.cs
- SinglePageViewer.cs
- SocketCache.cs
- FillRuleValidation.cs
- XmlArrayItemAttributes.cs
- XmlAnyAttributeAttribute.cs
- SplitterPanel.cs
- TableLayoutStyleCollection.cs
- NetSectionGroup.cs
- AnnotationAuthorChangedEventArgs.cs
- ExpressionVisitor.cs
- NativeMethodsOther.cs
- ToolStripDropDownItem.cs
- RectIndependentAnimationStorage.cs
- CharacterBufferReference.cs
- Propagator.cs
- webproxy.cs
- Normalization.cs
- TdsEnums.cs
- ISO2022Encoding.cs
- __FastResourceComparer.cs
- WebPartMenuStyle.cs
- WindowsServiceCredential.cs
- XmlSchemaFacet.cs
- MetaModel.cs
- SmtpTransport.cs
- ModelVisual3D.cs
- UnsafeMethods.cs
- HttpMethodConstraint.cs
- SoapAttributeOverrides.cs
- ProbeMatches11.cs
- TreeIterator.cs
- StrongNameMembershipCondition.cs
- RootDesignerSerializerAttribute.cs
- SecurityDescriptor.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- Emitter.cs
- BlurEffect.cs
- BamlMapTable.cs
- SqlError.cs
- AddInSegmentDirectoryNotFoundException.cs
- OrCondition.cs
- RankException.cs
- SerializationInfo.cs
- MobileControlBuilder.cs
- EmissiveMaterial.cs
- Screen.cs
- StringAnimationUsingKeyFrames.cs
- TableStyle.cs
- Part.cs