Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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; } } }[To be supplied.] ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SystemDropShadowChrome.cs
- DatePickerAutomationPeer.cs
- FormsAuthenticationConfiguration.cs
- OuterGlowBitmapEffect.cs
- ActivityScheduledQuery.cs
- KeyFrames.cs
- UserControl.cs
- WindowsFormsLinkLabel.cs
- InternalConfigEventArgs.cs
- ContentValidator.cs
- EmissiveMaterial.cs
- BitmapScalingModeValidation.cs
- ProjectionPruner.cs
- EntityDataSourceSelectingEventArgs.cs
- NativeRightsManagementAPIsStructures.cs
- Behavior.cs
- PerspectiveCamera.cs
- ThreadPool.cs
- DeferredTextReference.cs
- EventEntry.cs
- Rectangle.cs
- IRCollection.cs
- SecurityException.cs
- bindurihelper.cs
- TextBoxDesigner.cs
- WebPartDisplayMode.cs
- Calendar.cs
- PrivilegeNotHeldException.cs
- RangeValueProviderWrapper.cs
- StateDesigner.Layouts.cs
- TrueReadOnlyCollection.cs
- GeometryValueSerializer.cs
- CommonServiceBehaviorElement.cs
- PersonalizationProviderCollection.cs
- SchemaInfo.cs
- UserUseLicenseDictionaryLoader.cs
- Vector3DCollection.cs
- Attributes.cs
- SiteMapPath.cs
- ToolBar.cs
- ICollection.cs
- DuplicateWaitObjectException.cs
- UpdatePanelTrigger.cs
- ReadOnlyAttribute.cs
- xmlformatgeneratorstatics.cs
- TransformerConfigurationWizardBase.cs
- ClrProviderManifest.cs
- UnsafeNativeMethodsMilCoreApi.cs
- HexParser.cs
- TransformerTypeCollection.cs
- ToggleButtonAutomationPeer.cs
- SystemParameters.cs
- Dictionary.cs
- DockProviderWrapper.cs
- clipboard.cs
- AppDomainFactory.cs
- SqlTypeConverter.cs
- GlobalizationSection.cs
- EngineSite.cs
- ReadOnlyDictionary.cs
- ItemDragEvent.cs
- XmlUrlResolver.cs
- ExtensionWindow.cs
- DropShadowEffect.cs
- SelectionItemProviderWrapper.cs
- CompiledQuery.cs
- VideoDrawing.cs
- MessageQueueEnumerator.cs
- WindowsFormsHelpers.cs
- StickyNoteAnnotations.cs
- StorageComplexTypeMapping.cs
- ControlValuePropertyAttribute.cs
- MergablePropertyAttribute.cs
- StateWorkerRequest.cs
- TreeIterator.cs
- JsonServiceDocumentSerializer.cs
- unsafenativemethodsother.cs
- EventKeyword.cs
- QueryRewriter.cs
- AutoCompleteStringCollection.cs
- RepeatInfo.cs
- ParameterElementCollection.cs
- SimpleRecyclingCache.cs
- FunctionNode.cs
- ExpressionBuilderContext.cs
- CodeExpressionCollection.cs
- AnnotationHighlightLayer.cs
- TypeLoadException.cs
- DelayedRegex.cs
- PathGradientBrush.cs
- ListViewItemEventArgs.cs
- RecordsAffectedEventArgs.cs
- ViewgenContext.cs
- HyperLinkStyle.cs
- XpsResourcePolicy.cs
- ProvidersHelper.cs
- GlyphElement.cs
- Interlocked.cs
- PortCache.cs
- RepeaterCommandEventArgs.cs