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
- BaseContextMenu.cs
- RedistVersionInfo.cs
- WebContext.cs
- ServicePoint.cs
- InertiaRotationBehavior.cs
- XPathNodeInfoAtom.cs
- TextFormatterHost.cs
- ValidateNames.cs
- FixedSOMPageConstructor.cs
- NullableLongSumAggregationOperator.cs
- AppDomainResourcePerfCounters.cs
- ImmutableObjectAttribute.cs
- SmtpNegotiateAuthenticationModule.cs
- ForeignKeyConstraint.cs
- XmlSiteMapProvider.cs
- CompositionTarget.cs
- SystemIPGlobalProperties.cs
- SqlRecordBuffer.cs
- RelatedPropertyManager.cs
- EpmCustomContentDeSerializer.cs
- ListMarkerSourceInfo.cs
- PassportIdentity.cs
- BuildProviderCollection.cs
- QilTypeChecker.cs
- UnmanagedMarshal.cs
- PerformanceCounterManager.cs
- CloudCollection.cs
- TrustDriver.cs
- LogReserveAndAppendState.cs
- Point4D.cs
- ResourcePart.cs
- DependencyObjectPropertyDescriptor.cs
- ParenExpr.cs
- CacheDict.cs
- WsdlBuildProvider.cs
- BitmapEffectState.cs
- SchemaObjectWriter.cs
- XmlSchemaExporter.cs
- ConfigXmlWhitespace.cs
- RequestCacheValidator.cs
- IntPtr.cs
- WindowsListViewItemStartMenu.cs
- EpmSyndicationContentDeSerializer.cs
- TypeDependencyAttribute.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- DirectionalLight.cs
- Selector.cs
- VisualStates.cs
- FileEnumerator.cs
- DataObjectMethodAttribute.cs
- MsmqOutputMessage.cs
- TransformValueSerializer.cs
- PrimitiveDataContract.cs
- TimeoutException.cs
- ValidationErrorEventArgs.cs
- FastEncoderWindow.cs
- MachineSettingsSection.cs
- TraceLog.cs
- ArrangedElementCollection.cs
- SoapExtensionTypeElementCollection.cs
- XmlStreamedByteStreamReader.cs
- EntitySetDataBindingList.cs
- HtmlWindowCollection.cs
- BaseDataBoundControl.cs
- DataGrid.cs
- XmlSchemaAttributeGroup.cs
- FileDialog_Vista.cs
- DataTableExtensions.cs
- ProgressBar.cs
- DataControlFieldCollection.cs
- PageContentCollection.cs
- Win32MouseDevice.cs
- TagMapCollection.cs
- ButtonFlatAdapter.cs
- RadioButtonBaseAdapter.cs
- graph.cs
- SqlTypeConverter.cs
- CodeConditionStatement.cs
- KnownBoxes.cs
- StringCollection.cs
- EntityException.cs
- BaseTemplateBuildProvider.cs
- ComplexObject.cs
- PromptBuilder.cs
- GlyphElement.cs
- ITreeGenerator.cs
- DataSourceControl.cs
- SchemaLookupTable.cs
- PersonalizableAttribute.cs
- DrawListViewSubItemEventArgs.cs
- BCLDebug.cs
- DateTimeAutomationPeer.cs
- UnicastIPAddressInformationCollection.cs
- _StreamFramer.cs
- Underline.cs
- MessageQueueKey.cs
- OracleFactory.cs
- Odbc32.cs
- ObjectDataSourceDisposingEventArgs.cs
- SecureEnvironment.cs