Code:
/ FX-1434 / FX-1434 / 1.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
- HttpClientCertificate.cs
- RadioButton.cs
- InheritablePropertyChangeInfo.cs
- AdapterDictionary.cs
- HttpApplication.cs
- StaticSiteMapProvider.cs
- DataGridViewLinkCell.cs
- DesignerOptionService.cs
- InstanceHandleConflictException.cs
- SiteMapNodeCollection.cs
- Simplifier.cs
- BigInt.cs
- PageRequestManager.cs
- OleDbConnectionFactory.cs
- CheckBoxFlatAdapter.cs
- BaseCodeDomTreeGenerator.cs
- PointCollectionValueSerializer.cs
- FieldTemplateFactory.cs
- FieldToken.cs
- ContainerAction.cs
- KeyFrames.cs
- AudioException.cs
- State.cs
- OutputCacheSettings.cs
- DesignTimeParseData.cs
- ServiceSecurityContext.cs
- PropertyEmitterBase.cs
- ItemDragEvent.cs
- XmlNamespaceDeclarationsAttribute.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- SafeHandle.cs
- WebSysDescriptionAttribute.cs
- FillErrorEventArgs.cs
- XamlGridLengthSerializer.cs
- IssuedTokenClientElement.cs
- WsatServiceCertificate.cs
- StrokeNodeOperations.cs
- Stackframe.cs
- FrameworkObject.cs
- IdentitySection.cs
- ProtocolsConfiguration.cs
- LinkAreaEditor.cs
- MethodBody.cs
- SQLInt64Storage.cs
- FrameworkContentElement.cs
- _RequestCacheProtocol.cs
- SelectionRangeConverter.cs
- TripleDES.cs
- RuntimeResourceSet.cs
- ByteConverter.cs
- GuidTagList.cs
- Selection.cs
- ResourceAttributes.cs
- CodeParameterDeclarationExpressionCollection.cs
- XmlSchemaCompilationSettings.cs
- HMACMD5.cs
- BindingContext.cs
- BitConverter.cs
- CodeCatchClauseCollection.cs
- SqlReferenceCollection.cs
- MetaTable.cs
- WebPartConnectionsDisconnectVerb.cs
- Exceptions.cs
- PEFileEvidenceFactory.cs
- GregorianCalendarHelper.cs
- ModifiableIteratorCollection.cs
- GreenMethods.cs
- RegexCharClass.cs
- LeaseManager.cs
- StringWriter.cs
- XmlDataDocument.cs
- PackUriHelper.cs
- loginstatus.cs
- ParserStreamGeometryContext.cs
- Cursors.cs
- HybridWebProxyFinder.cs
- AttachedAnnotation.cs
- ImageAutomationPeer.cs
- ManagedWndProcTracker.cs
- EdmConstants.cs
- CheckableControlBaseAdapter.cs
- HtmlInputRadioButton.cs
- HitTestDrawingContextWalker.cs
- GeneralTransformGroup.cs
- XmlEncoding.cs
- HttpListenerPrefixCollection.cs
- MustUnderstandSoapException.cs
- SafeProcessHandle.cs
- Executor.cs
- HeaderElement.cs
- QuaternionValueSerializer.cs
- SessionParameter.cs
- MachineKeySection.cs
- EventPropertyMap.cs
- NoResizeSelectionBorderGlyph.cs
- HttpDebugHandler.cs
- StrokeIntersection.cs
- IgnoreDeviceFilterElementCollection.cs
- FreezableOperations.cs
- ISAPIRuntime.cs