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
- ButtonFlatAdapter.cs
- AutoGeneratedField.cs
- PopupEventArgs.cs
- ImageList.cs
- ReaderWriterLock.cs
- JsonReaderDelegator.cs
- MultiSelector.cs
- BamlCollectionHolder.cs
- WebSysDescriptionAttribute.cs
- PolyLineSegment.cs
- MailDefinition.cs
- ListViewGroup.cs
- DesignerTransactionCloseEvent.cs
- UnwrappedTypesXmlSerializerManager.cs
- AtomServiceDocumentSerializer.cs
- BoundColumn.cs
- LogExtentCollection.cs
- Rect3D.cs
- KeyGestureValueSerializer.cs
- XmlSchemaComplexContentExtension.cs
- ScrollBar.cs
- DbReferenceCollection.cs
- ChangeNode.cs
- FaultDescriptionCollection.cs
- CheckBoxField.cs
- FunctionDescription.cs
- DocumentViewerBaseAutomationPeer.cs
- HttpDictionary.cs
- AttributeEmitter.cs
- SystemIPAddressInformation.cs
- SmiEventSink_DeferedProcessing.cs
- RegexMatchCollection.cs
- ConfigurationManagerHelper.cs
- InstanceCreationEditor.cs
- WebPartDisplayModeCancelEventArgs.cs
- RSAPKCS1SignatureFormatter.cs
- LayoutManager.cs
- LinkLabel.cs
- XmlSchemaAnnotation.cs
- EntityDesignerDataSourceView.cs
- XhtmlBasicValidatorAdapter.cs
- Int32CollectionConverter.cs
- SqlCacheDependencyDatabaseCollection.cs
- ProfileInfo.cs
- DateTimeUtil.cs
- RuntimeTrackingProfile.cs
- ColumnResizeUndoUnit.cs
- FixedStringLookup.cs
- XmlSchemaAll.cs
- StrokeFIndices.cs
- LookupNode.cs
- ContentFileHelper.cs
- AssociationEndMember.cs
- CodeSnippetExpression.cs
- SqlProcedureAttribute.cs
- FormViewUpdatedEventArgs.cs
- ToolStripLabel.cs
- ChtmlCommandAdapter.cs
- QilParameter.cs
- GeneralTransform3DCollection.cs
- XmlElementAttribute.cs
- TextEditorLists.cs
- CorrelationHandle.cs
- PrimarySelectionAdorner.cs
- NamespaceMapping.cs
- Part.cs
- TaskbarItemInfo.cs
- EntityClientCacheEntry.cs
- BufferedGraphics.cs
- FixedTextPointer.cs
- RequiredFieldValidator.cs
- WhitespaceRuleLookup.cs
- DrawingContextDrawingContextWalker.cs
- Binding.cs
- TreeNode.cs
- HttpClientChannel.cs
- StyleCollection.cs
- InertiaExpansionBehavior.cs
- ServiceReflector.cs
- AsyncSerializedWorker.cs
- ClientOperationFormatterProvider.cs
- PageThemeBuildProvider.cs
- ConstraintEnumerator.cs
- DateTimeFormatInfo.cs
- Variant.cs
- Compiler.cs
- StringArrayConverter.cs
- CompoundFileDeflateTransform.cs
- XPathNode.cs
- MimeAnyImporter.cs
- ProcessModule.cs
- SynchronizationLockException.cs
- LocalizabilityAttribute.cs
- ProtectedConfigurationSection.cs
- TimeZoneInfo.cs
- XmlSchemaExporter.cs
- FileDataSourceCache.cs
- DbConnectionPoolGroupProviderInfo.cs
- ComplexTypeEmitter.cs
- PropertyDescriptorGridEntry.cs