Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- HttpModuleActionCollection.cs
- ImageListUtils.cs
- BatchWriter.cs
- DelegateBodyWriter.cs
- MSAAWinEventWrap.cs
- XmlDocumentViewSchema.cs
- ListViewTableCell.cs
- ActivityBindForm.Designer.cs
- AddInProcess.cs
- JumpItem.cs
- OperationCanceledException.cs
- InternalEnumValidator.cs
- SQLDateTime.cs
- SchemaCompiler.cs
- WithStatement.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- IODescriptionAttribute.cs
- ExpressionConverter.cs
- TemplatedWizardStep.cs
- XamlPointCollectionSerializer.cs
- XmlSubtreeReader.cs
- SystemEvents.cs
- WebPartVerb.cs
- SID.cs
- EntityKey.cs
- RawMouseInputReport.cs
- DrawItemEvent.cs
- TypeSemantics.cs
- CodeTypeParameter.cs
- HtmlElementCollection.cs
- FixedDocumentSequencePaginator.cs
- ComplexLine.cs
- OdbcConnectionOpen.cs
- StringUtil.cs
- KeyGesture.cs
- ColorConvertedBitmap.cs
- XmlHierarchicalEnumerable.cs
- TripleDES.cs
- SortDescription.cs
- TryExpression.cs
- PointConverter.cs
- CodeSnippetCompileUnit.cs
- AppSecurityManager.cs
- EntityDataSourceChangedEventArgs.cs
- HyperLinkStyle.cs
- PropertyDescriptorCollection.cs
- TaskSchedulerException.cs
- ValueType.cs
- StandardTransformFactory.cs
- FunctionDefinition.cs
- ColumnCollectionEditor.cs
- ObjectCloneHelper.cs
- Soap12ProtocolImporter.cs
- HyperLinkField.cs
- NativeMethods.cs
- IfAction.cs
- documentsequencetextpointer.cs
- SHA512.cs
- TypeElement.cs
- ExceptionRoutedEventArgs.cs
- TemplatedMailWebEventProvider.cs
- StringToken.cs
- AnimationException.cs
- ComplexObject.cs
- DelegateBodyWriter.cs
- ReaderWriterLockWrapper.cs
- BamlBinaryWriter.cs
- SpeakProgressEventArgs.cs
- DesignerPerfEventProvider.cs
- PersonalizationStateInfoCollection.cs
- LambdaCompiler.ControlFlow.cs
- ImageDrawing.cs
- TextRangeBase.cs
- CuspData.cs
- Function.cs
- BindableAttribute.cs
- Cloud.cs
- DriveInfo.cs
- DbXmlEnabledProviderManifest.cs
- XamlBrushSerializer.cs
- PropertyGeneratedEventArgs.cs
- Psha1DerivedKeyGeneratorHelper.cs
- TableAdapterManagerGenerator.cs
- Cursors.cs
- CalendarSelectionChangedEventArgs.cs
- XmlWellformedWriter.cs
- PersistChildrenAttribute.cs
- ValueUnavailableException.cs
- GC.cs
- AuthenticationManager.cs
- ToolStripDropDownMenu.cs
- HandlerWithFactory.cs
- ArgumentOutOfRangeException.cs
- ColorConvertedBitmapExtension.cs
- HealthMonitoringSection.cs
- EntityDesignerBuildProvider.cs
- XmlUTF8TextReader.cs
- OdbcPermission.cs
- DataGridLinkButton.cs
- QfeChecker.cs