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
- ExitEventArgs.cs
- Int32.cs
- ReliabilityContractAttribute.cs
- ThicknessKeyFrameCollection.cs
- UrlPropertyAttribute.cs
- PrivilegeNotHeldException.cs
- ClientScriptManagerWrapper.cs
- XmlTextEncoder.cs
- DataFormat.cs
- X509Utils.cs
- CollectionChange.cs
- HtmlCommandAdapter.cs
- FixedNode.cs
- PrivilegedConfigurationManager.cs
- BlurBitmapEffect.cs
- EventLogEntryCollection.cs
- DataGridViewCellCancelEventArgs.cs
- X509CertificateChain.cs
- DataGridViewColumnCollection.cs
- RegexWorker.cs
- Trigger.cs
- SQLInt16Storage.cs
- XPathSelectionIterator.cs
- SecurityManager.cs
- OpenFileDialog.cs
- XappLauncher.cs
- DataTableMappingCollection.cs
- NextPreviousPagerField.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- TrackingValidationObjectDictionary.cs
- InputLanguageCollection.cs
- UnauthorizedWebPart.cs
- ThaiBuddhistCalendar.cs
- HtmlInputControl.cs
- BackStopAuthenticationModule.cs
- Int32RectConverter.cs
- WSFederationHttpSecurityElement.cs
- DefaultDiscoveryService.cs
- TypeBuilderInstantiation.cs
- ApplicationException.cs
- EditorBrowsableAttribute.cs
- DesignTimeVisibleAttribute.cs
- ProfileInfo.cs
- ValidationPropertyAttribute.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- SmtpSection.cs
- MILUtilities.cs
- XmlSchemaSet.cs
- ProgressChangedEventArgs.cs
- CellTreeNodeVisitors.cs
- DataObject.cs
- TCPListener.cs
- EntityConnectionStringBuilder.cs
- ProfileGroupSettingsCollection.cs
- CanonicalXml.cs
- IntegerCollectionEditor.cs
- coordinator.cs
- RecipientInfo.cs
- TableProviderWrapper.cs
- TopClause.cs
- HandlerFactoryWrapper.cs
- BinaryFormatter.cs
- InkCanvasAutomationPeer.cs
- Fonts.cs
- CachedFontFamily.cs
- IntegerValidatorAttribute.cs
- adornercollection.cs
- TemplateControlBuildProvider.cs
- Quad.cs
- WpfSharedXamlSchemaContext.cs
- StoreItemCollection.Loader.cs
- ReferenceTypeElement.cs
- TimelineGroup.cs
- ByteStream.cs
- Int32Converter.cs
- ObjectQueryProvider.cs
- AspCompat.cs
- Pens.cs
- SkipStoryboardToFill.cs
- FilterElement.cs
- Brush.cs
- diagnosticsswitches.cs
- BamlRecordHelper.cs
- RemotingConfiguration.cs
- ModulesEntry.cs
- WebBrowserProgressChangedEventHandler.cs
- InternalConfigEventArgs.cs
- DSASignatureFormatter.cs
- InertiaRotationBehavior.cs
- IdentityReference.cs
- xmlsaver.cs
- TargetControlTypeAttribute.cs
- Listbox.cs
- TrackingWorkflowEventArgs.cs
- SafeHandle.cs
- MappingItemCollection.cs
- DialogWindow.cs
- _KerberosClient.cs
- EventManager.cs
- TextPattern.cs