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
- ContentWrapperAttribute.cs
- xsdvalidator.cs
- FontWeight.cs
- Rect.cs
- DataMemberAttribute.cs
- FormattedTextSymbols.cs
- BooleanToVisibilityConverter.cs
- XmlSchemaComplexContent.cs
- ComponentCodeDomSerializer.cs
- TrimSurroundingWhitespaceAttribute.cs
- ConsumerConnectionPoint.cs
- CharAnimationBase.cs
- FlowLayoutPanel.cs
- MarkupCompilePass2.cs
- DataTable.cs
- ExpressionBinding.cs
- MethodImplAttribute.cs
- MdiWindowListItemConverter.cs
- PenThreadWorker.cs
- TextTreeExtractElementUndoUnit.cs
- QueuePathDialog.cs
- ContainerCodeDomSerializer.cs
- ArrayTypeMismatchException.cs
- HttpException.cs
- MergablePropertyAttribute.cs
- ServiceDefaults.cs
- AnnotationAuthorChangedEventArgs.cs
- DataSourceCache.cs
- InputLanguage.cs
- Vector.cs
- ObservableCollection.cs
- _SslSessionsCache.cs
- PopupRoot.cs
- HTTPNotFoundHandler.cs
- DataGridClipboardCellContent.cs
- TemplateControlParser.cs
- Delegate.cs
- LinqDataSourceValidationException.cs
- MetadataPropertyAttribute.cs
- CodeTypeConstructor.cs
- AutomationEventArgs.cs
- HttpRawResponse.cs
- ServiceModelConfigurationSectionCollection.cs
- Codec.cs
- ElementUtil.cs
- Base64Stream.cs
- MasterPageBuildProvider.cs
- CodeDirectionExpression.cs
- SqlMetaData.cs
- ListBase.cs
- ProcessModuleCollection.cs
- ListViewUpdatedEventArgs.cs
- XPathMessageFilterTable.cs
- Empty.cs
- ProofTokenCryptoHandle.cs
- ValuePatternIdentifiers.cs
- VoiceSynthesis.cs
- DataGridViewCheckBoxCell.cs
- BufferedGraphicsManager.cs
- WinEventHandler.cs
- DesignerHelpers.cs
- HandlerBase.cs
- LogoValidationException.cs
- HttpProfileGroupBase.cs
- ChtmlTextWriter.cs
- Run.cs
- CompiledQuery.cs
- EarlyBoundInfo.cs
- XmlDigitalSignatureProcessor.cs
- SystemIPGlobalStatistics.cs
- QueryCacheKey.cs
- TraceFilter.cs
- TreeBuilderBamlTranslator.cs
- MenuTracker.cs
- XPathBuilder.cs
- NativeMethods.cs
- TextBox.cs
- FreezableDefaultValueFactory.cs
- DiscoveryViaBehavior.cs
- DataControlField.cs
- OciHandle.cs
- PropertyTab.cs
- SecurityTokenSerializer.cs
- DataRowChangeEvent.cs
- RemoteWebConfigurationHostStream.cs
- EntitySqlQueryCacheKey.cs
- RijndaelManaged.cs
- HttpCookie.cs
- CodeParameterDeclarationExpression.cs
- shaperfactoryquerycachekey.cs
- ILGenerator.cs
- EmptyElement.cs
- Line.cs
- Array.cs
- CharEnumerator.cs
- SemaphoreSecurity.cs
- XmlNavigatorFilter.cs
- AddDataControlFieldDialog.cs
- DragDrop.cs
- AspProxy.cs