Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / Util / SymbolEqualComparer.cs / 1 / SymbolEqualComparer.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Util { using System.Collections; using System.Globalization; ////// internal class SymbolEqualComparer: IComparer { ////// For internal use only. This implements a comparison that only /// checks for equalilty, so this should only be used in un-sorted data /// structures like Hastable and ListDictionary. This is a little faster /// than using CaseInsensitiveComparer because it does a strict character by /// character equality chech rather than a sorted comparison. /// ////// internal static readonly IComparer Default = new SymbolEqualComparer(); internal SymbolEqualComparer() { } int IComparer.Compare(object keyLeft, object keyRight) { string sLeft = keyLeft as string; string sRight = keyRight as string; if (sLeft == null) { throw new ArgumentNullException("keyLeft"); } if (sRight == null) { throw new ArgumentNullException("keyRight"); } int lLeft = sLeft.Length; int lRight = sRight.Length; if (lLeft != lRight) { return 1; } for (int i = 0; i < lLeft; i++) { char charLeft = sLeft[i]; char charRight = sRight[i]; if (charLeft == charRight) { continue; } UnicodeCategory catLeft = Char.GetUnicodeCategory(charLeft); UnicodeCategory catRight = Char.GetUnicodeCategory(charRight); if (catLeft == UnicodeCategory.UppercaseLetter && catRight == UnicodeCategory.LowercaseLetter) { if (Char.ToLower(charLeft, CultureInfo.InvariantCulture) == charRight) { continue; } } else if (catRight == UnicodeCategory.UppercaseLetter && catLeft == UnicodeCategory.LowercaseLetter){ if (Char.ToLower(charRight, CultureInfo.InvariantCulture) == charLeft) { continue; } } return 1; } return 0; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //[To be supplied.] ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Util { using System.Collections; using System.Globalization; ////// internal class SymbolEqualComparer: IComparer { ////// For internal use only. This implements a comparison that only /// checks for equalilty, so this should only be used in un-sorted data /// structures like Hastable and ListDictionary. This is a little faster /// than using CaseInsensitiveComparer because it does a strict character by /// character equality chech rather than a sorted comparison. /// ////// internal static readonly IComparer Default = new SymbolEqualComparer(); internal SymbolEqualComparer() { } int IComparer.Compare(object keyLeft, object keyRight) { string sLeft = keyLeft as string; string sRight = keyRight as string; if (sLeft == null) { throw new ArgumentNullException("keyLeft"); } if (sRight == null) { throw new ArgumentNullException("keyRight"); } int lLeft = sLeft.Length; int lRight = sRight.Length; if (lLeft != lRight) { return 1; } for (int i = 0; i < lLeft; i++) { char charLeft = sLeft[i]; char charRight = sRight[i]; if (charLeft == charRight) { continue; } UnicodeCategory catLeft = Char.GetUnicodeCategory(charLeft); UnicodeCategory catRight = Char.GetUnicodeCategory(charRight); if (catLeft == UnicodeCategory.UppercaseLetter && catRight == UnicodeCategory.LowercaseLetter) { if (Char.ToLower(charLeft, CultureInfo.InvariantCulture) == charRight) { continue; } } else if (catRight == UnicodeCategory.UppercaseLetter && catLeft == UnicodeCategory.LowercaseLetter){ if (Char.ToLower(charRight, CultureInfo.InvariantCulture) == charLeft) { continue; } } return 1; } return 0; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Scripts.cs
- HtmlTableCellCollection.cs
- BufferedMessageWriter.cs
- AmbientValueAttribute.cs
- DateTimeStorage.cs
- MeasureData.cs
- ListenerAdaptersInstallComponent.cs
- SharedUtils.cs
- MultipleViewProviderWrapper.cs
- ADMembershipProvider.cs
- TimeoutValidationAttribute.cs
- DataControlFieldHeaderCell.cs
- unsafenativemethodsother.cs
- SynchronizingStream.cs
- WebEventTraceProvider.cs
- RuleRef.cs
- Page.cs
- ExecutionScope.cs
- EntityCollection.cs
- DecoderNLS.cs
- JsonUriDataContract.cs
- ColorConvertedBitmap.cs
- ProfileGroupSettings.cs
- XmlAttributeProperties.cs
- TraceContextRecord.cs
- _BufferOffsetSize.cs
- SspiSecurityTokenProvider.cs
- BamlStream.cs
- DecoderFallback.cs
- CodeCompileUnit.cs
- Compiler.cs
- StylusLogic.cs
- AddToCollection.cs
- XmlElementAttribute.cs
- XmlKeywords.cs
- HttpModuleActionCollection.cs
- ToolStripSeparator.cs
- CodeDomConfigurationHandler.cs
- WindowsTreeView.cs
- DataTableReaderListener.cs
- BrowserCapabilitiesFactory.cs
- SafeLibraryHandle.cs
- shaperfactoryquerycacheentry.cs
- InkPresenter.cs
- CompilerGlobalScopeAttribute.cs
- SignatureResourcePool.cs
- CacheOutputQuery.cs
- TypeSystem.cs
- WebHeaderCollection.cs
- AccessControlList.cs
- UpdatePanelTrigger.cs
- ClientSideProviderDescription.cs
- MexHttpBindingElement.cs
- DesignerToolStripControlHost.cs
- InternalSafeNativeMethods.cs
- WindowsBrush.cs
- WSHttpTransportSecurityElement.cs
- ImpersonationContext.cs
- DataSourceControlBuilder.cs
- HttpListener.cs
- PageTextBox.cs
- TextEditorDragDrop.cs
- WebPartsPersonalization.cs
- AppLevelCompilationSectionCache.cs
- PenContext.cs
- GridViewCommandEventArgs.cs
- ContainerCodeDomSerializer.cs
- login.cs
- AutoSizeToolBoxItem.cs
- milexports.cs
- PrintDialogException.cs
- CounterNameConverter.cs
- MetadataItem.cs
- AssemblyName.cs
- LambdaCompiler.Address.cs
- UrlAuthorizationModule.cs
- HuffmanTree.cs
- NonBatchDirectoryCompiler.cs
- ChooseAction.cs
- TransportContext.cs
- XmlSchemaSubstitutionGroup.cs
- WindowsTokenRoleProvider.cs
- EditorAttribute.cs
- StretchValidation.cs
- TaiwanLunisolarCalendar.cs
- ExecutionEngineException.cs
- HtmlControl.cs
- RichTextBoxContextMenu.cs
- LocalizableResourceBuilder.cs
- DateTimeUtil.cs
- ProcessManager.cs
- XmlSchemaAll.cs
- SubMenuStyle.cs
- EntityContainerEntitySet.cs
- ColorContext.cs
- TemplateXamlParser.cs
- XslCompiledTransform.cs
- BitmapCodecInfo.cs
- Stroke.cs
- XmlLinkedNode.cs