Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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. // Copyright (c) Microsoft Corporation. All rights reserved.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RawTextInputReport.cs
- PlaceHolder.cs
- SystemIcmpV6Statistics.cs
- MetadataHelper.cs
- WasEndpointConfigContainer.cs
- StagingAreaInputItem.cs
- RSAPKCS1KeyExchangeFormatter.cs
- ProxyElement.cs
- ToolStripDropDownClosedEventArgs.cs
- RuleSettings.cs
- TrackingDataItemValue.cs
- InkCanvasSelection.cs
- DetailsViewPagerRow.cs
- DataGridViewAdvancedBorderStyle.cs
- ProviderConnectionPoint.cs
- PeerContact.cs
- MetabaseSettingsIis7.cs
- ProviderConnectionPointCollection.cs
- ToolBar.cs
- Solver.cs
- XmlReflectionImporter.cs
- TreeViewHitTestInfo.cs
- DataGridViewCellStyleChangedEventArgs.cs
- ConfigurationSectionHelper.cs
- GridViewCancelEditEventArgs.cs
- XPathAncestorQuery.cs
- oledbconnectionstring.cs
- AuthenticationException.cs
- EventRecord.cs
- PathNode.cs
- BufferedGraphicsContext.cs
- GenericsInstances.cs
- DelegateBodyWriter.cs
- DataGridRow.cs
- Nodes.cs
- TokenFactoryCredential.cs
- MD5CryptoServiceProvider.cs
- xmlsaver.cs
- TypeDependencyAttribute.cs
- ConfigurationValues.cs
- Size3D.cs
- BehaviorService.cs
- DataSourceView.cs
- StorageEntityTypeMapping.cs
- PropertyDescriptorComparer.cs
- SqlAliasesReferenced.cs
- ObjectDataSourceSelectingEventArgs.cs
- DataObjectCopyingEventArgs.cs
- PrinterSettings.cs
- DesignerActionUI.cs
- DesignerUtils.cs
- EncryptedKey.cs
- FilterQuery.cs
- XmlDictionaryReader.cs
- EmbeddedMailObject.cs
- WebZone.cs
- SpotLight.cs
- InternalMappingException.cs
- ChangesetResponse.cs
- PanelDesigner.cs
- DBParameter.cs
- EntityCodeGenerator.cs
- XmlSignatureProperties.cs
- FileFormatException.cs
- CanonicalizationDriver.cs
- ListViewItem.cs
- templategroup.cs
- UnionExpr.cs
- IDispatchConstantAttribute.cs
- SessionState.cs
- TableRow.cs
- sqlstateclientmanager.cs
- EntityClassGenerator.cs
- ContentDisposition.cs
- SystemIcmpV6Statistics.cs
- KeyEventArgs.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- XmlnsPrefixAttribute.cs
- ListViewItemMouseHoverEvent.cs
- XsdBuildProvider.cs
- AssemblyResourceLoader.cs
- TreeViewAutomationPeer.cs
- BigIntegerStorage.cs
- ColorContextHelper.cs
- FutureFactory.cs
- CodeDelegateInvokeExpression.cs
- ConfigXmlText.cs
- ImageSource.cs
- Compiler.cs
- SettingsContext.cs
- CanExecuteRoutedEventArgs.cs
- UnsafeNativeMethodsCLR.cs
- AppSettingsReader.cs
- EditorZone.cs
- Literal.cs
- SafeSystemMetrics.cs
- UrlMappingsModule.cs
- DetailsViewDeletedEventArgs.cs
- SymDocumentType.cs
- SqlException.cs