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
- MailHeaderInfo.cs
- TextEndOfParagraph.cs
- ProviderException.cs
- UserNamePasswordServiceCredential.cs
- _CommandStream.cs
- XmlSchemaProviderAttribute.cs
- SelectionList.cs
- DEREncoding.cs
- TrackingProfileCache.cs
- TextBoxBase.cs
- SortKey.cs
- CompleteWizardStep.cs
- ReferenceConverter.cs
- BinaryNode.cs
- SplitterPanelDesigner.cs
- ObjectManager.cs
- BinaryCommonClasses.cs
- GenericUI.cs
- Font.cs
- StreamHelper.cs
- WorkflowTransactionService.cs
- WindowsRegion.cs
- FormView.cs
- PermissionSet.cs
- UxThemeWrapper.cs
- ContentWrapperAttribute.cs
- WindowsPrincipal.cs
- StylusPointPropertyInfo.cs
- OpacityConverter.cs
- FixedSOMSemanticBox.cs
- ProxyAttribute.cs
- DBCommand.cs
- HtmlGenericControl.cs
- CookieHandler.cs
- RSAOAEPKeyExchangeDeformatter.cs
- StrokeCollectionDefaultValueFactory.cs
- BitStream.cs
- NavigateUrlConverter.cs
- HostingEnvironmentSection.cs
- AuthenticationConfig.cs
- HtmlTextArea.cs
- GeneralTransform2DTo3DTo2D.cs
- ReferentialConstraint.cs
- Attribute.cs
- TabControlAutomationPeer.cs
- BamlRecordHelper.cs
- CodeDomDecompiler.cs
- WebControlAdapter.cs
- RowVisual.cs
- dsa.cs
- StorageBasedPackageProperties.cs
- SqlEnums.cs
- SecurityToken.cs
- DbgUtil.cs
- SiteMapNodeItem.cs
- SingleAnimationUsingKeyFrames.cs
- PeerValidationBehavior.cs
- OpenCollectionAsyncResult.cs
- PathFigureCollection.cs
- oledbmetadatacolumnnames.cs
- GetParentChain.cs
- remotingproxy.cs
- Single.cs
- PropertySet.cs
- EntityDataSourceDataSelection.cs
- HttpVersion.cs
- RelationshipEndCollection.cs
- XmlSerializerSection.cs
- ReflectionHelper.cs
- SmtpNegotiateAuthenticationModule.cs
- Scheduling.cs
- XmlMembersMapping.cs
- BufferedReadStream.cs
- TextReader.cs
- COM2ExtendedUITypeEditor.cs
- BaseServiceProvider.cs
- MarkedHighlightComponent.cs
- XmlCharacterData.cs
- FileSystemInfo.cs
- ImagingCache.cs
- LinkAreaEditor.cs
- InputDevice.cs
- RegexWorker.cs
- TabItemAutomationPeer.cs
- CompressionTransform.cs
- Vector.cs
- ExtensionDataReader.cs
- SmiMetaDataProperty.cs
- ContentElement.cs
- SvcMapFile.cs
- CmsInterop.cs
- Pts.cs
- SqlDataSourceSelectingEventArgs.cs
- TextElementCollectionHelper.cs
- CheckedPointers.cs
- Lazy.cs
- DoubleAnimationUsingPath.cs
- DetailsViewRow.cs
- ConstraintConverter.cs
- IRCollection.cs