Code:
/ DotNET / DotNET / 8.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
- KernelTypeValidation.cs
- _NTAuthentication.cs
- WsdlBuildProvider.cs
- GeneralTransform3DCollection.cs
- Compilation.cs
- ToolStripDropDownButton.cs
- XmlCharType.cs
- ClientProtocol.cs
- InkPresenterAutomationPeer.cs
- DateTimeEditor.cs
- _LocalDataStore.cs
- XmlAnyElementAttribute.cs
- MethodBuilder.cs
- RegexInterpreter.cs
- XamlPoint3DCollectionSerializer.cs
- XamlSerializer.cs
- WorkflowTransactionOptions.cs
- CommonRemoteMemoryBlock.cs
- CollectionTraceRecord.cs
- SmiRequestExecutor.cs
- XmlQueryType.cs
- PropertyGridView.cs
- SvcMapFileLoader.cs
- EntityDataReader.cs
- UInt32.cs
- TypeInitializationException.cs
- XmlNode.cs
- InvalidDocumentContentsException.cs
- TreeNodeStyleCollection.cs
- TimeEnumHelper.cs
- SmiEventSink.cs
- ClosableStream.cs
- OracleConnectionStringBuilder.cs
- Visual3D.cs
- PrintingPermission.cs
- DbXmlEnabledProviderManifest.cs
- GridViewDesigner.cs
- ObjectParameter.cs
- ClaimComparer.cs
- NullableFloatAverageAggregationOperator.cs
- SqlDuplicator.cs
- CacheOutputQuery.cs
- SingleTagSectionHandler.cs
- Buffer.cs
- BypassElement.cs
- SurrogateSelector.cs
- WsatAdminException.cs
- ContainerVisual.cs
- BamlRecords.cs
- Baml2006ReaderFrame.cs
- CacheEntry.cs
- Win32KeyboardDevice.cs
- GPPOINTF.cs
- DataKey.cs
- DataControlFieldCollection.cs
- FixedMaxHeap.cs
- VerificationAttribute.cs
- OrderedDictionaryStateHelper.cs
- ElementHostPropertyMap.cs
- AttributeSetAction.cs
- Console.cs
- ProfileSection.cs
- DesignerActionUIService.cs
- PartialCachingControl.cs
- ProcessHost.cs
- ToolStripContentPanel.cs
- AutomationPatternInfo.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- DesignerSerializationOptionsAttribute.cs
- KnownTypesHelper.cs
- BasicDesignerLoader.cs
- CultureInfoConverter.cs
- Pair.cs
- CompilationRelaxations.cs
- TaskResultSetter.cs
- HashStream.cs
- GetRecipientRequest.cs
- HttpGetProtocolImporter.cs
- GPPOINTF.cs
- AsymmetricCryptoHandle.cs
- CaseKeyBox.xaml.cs
- invalidudtexception.cs
- WebPartExportVerb.cs
- Tuple.cs
- NotFiniteNumberException.cs
- ActivitySurrogateSelector.cs
- InstancePersistence.cs
- InternalUserCancelledException.cs
- TextBoxAutomationPeer.cs
- TrustLevel.cs
- SystemIPInterfaceProperties.cs
- ThemeableAttribute.cs
- ProcessModuleCollection.cs
- DataGridAddNewRow.cs
- DesignBindingConverter.cs
- DBBindings.cs
- ExpressionBuilderContext.cs
- EventWaitHandleSecurity.cs
- CompositeDuplexBindingElementImporter.cs
- XPathArrayIterator.cs