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
- BitmapEffect.cs
- ResourceBinder.cs
- CriticalHandle.cs
- ProfilePropertyNameValidator.cs
- PolicyAssertionCollection.cs
- ProfileGroupSettingsCollection.cs
- RuntimeHelpers.cs
- Operator.cs
- MdImport.cs
- RectAnimationUsingKeyFrames.cs
- TransportListener.cs
- SettingsAttributeDictionary.cs
- InputProviderSite.cs
- TextLineBreak.cs
- ParserExtension.cs
- XmlEnumAttribute.cs
- FieldToken.cs
- ArgumentOutOfRangeException.cs
- IntellisenseTextBox.cs
- TypedColumnHandler.cs
- HtmlSelect.cs
- FlowDocumentReader.cs
- AttachedPropertyMethodSelector.cs
- SqlRowUpdatingEvent.cs
- CodePropertyReferenceExpression.cs
- CompilerErrorCollection.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- CaseInsensitiveOrdinalStringComparer.cs
- dbenumerator.cs
- ServiceBuildProvider.cs
- SystemGatewayIPAddressInformation.cs
- ShadowGlyph.cs
- TemplateControlCodeDomTreeGenerator.cs
- BaseCollection.cs
- TransactionInterop.cs
- MutexSecurity.cs
- MarginCollapsingState.cs
- BindingCollection.cs
- DataPointer.cs
- ScriptReferenceBase.cs
- ThemeInfoAttribute.cs
- GridViewCancelEditEventArgs.cs
- SourceChangedEventArgs.cs
- DrawingCollection.cs
- wgx_render.cs
- NamespaceCollection.cs
- PermissionToken.cs
- CodePrimitiveExpression.cs
- ImmutableObjectAttribute.cs
- UriTemplateCompoundPathSegment.cs
- ParentControlDesigner.cs
- DesignerOptionService.cs
- IsolatedStorageFile.cs
- Point3D.cs
- DataControlButton.cs
- RecognizedAudio.cs
- DocumentViewerHelper.cs
- ArrayMergeHelper.cs
- ConnectionStringSettings.cs
- DetailsView.cs
- DataRecordObjectView.cs
- ActivitiesCollection.cs
- ShaperBuffers.cs
- Message.cs
- WebAdminConfigurationHelper.cs
- TailCallAnalyzer.cs
- XmlILTrace.cs
- CodeThrowExceptionStatement.cs
- RenderDataDrawingContext.cs
- ConfigurationValue.cs
- ActivityTypeResolver.xaml.cs
- FrameDimension.cs
- QilValidationVisitor.cs
- DoubleConverter.cs
- ContextQuery.cs
- TextBox.cs
- PolicyFactory.cs
- CodeDesigner.cs
- KeyNotFoundException.cs
- SessionIDManager.cs
- WindowsListViewScroll.cs
- MappingSource.cs
- Dictionary.cs
- ConfigurationManagerInternal.cs
- XmlCharacterData.cs
- AttachedPropertyBrowsableAttribute.cs
- HttpVersion.cs
- DynamicHyperLink.cs
- SoapHeader.cs
- BamlMapTable.cs
- X509CertificateInitiatorClientCredential.cs
- PreProcessInputEventArgs.cs
- JsonSerializer.cs
- WebPartConnectionsConnectVerb.cs
- TraceHwndHost.cs
- AutoGeneratedFieldProperties.cs
- ModelServiceImpl.cs
- TextFormatterImp.cs
- HttpServerVarsCollection.cs
- FeatureAttribute.cs