Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / 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.] ///// 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
- _Connection.cs
- ParseHttpDate.cs
- CharAnimationBase.cs
- DesignerListAdapter.cs
- DbDataAdapter.cs
- WmlLinkAdapter.cs
- StaticExtension.cs
- XmlReflectionImporter.cs
- TileBrush.cs
- BitmapEncoder.cs
- FlowDocumentView.cs
- Stack.cs
- XmlAttributes.cs
- BigInt.cs
- CalendarDay.cs
- ConnectionPointGlyph.cs
- LocalizableResourceBuilder.cs
- SafeCryptContextHandle.cs
- BasicExpandProvider.cs
- CustomCredentialPolicy.cs
- MachineKeyConverter.cs
- CompatibleIComparer.cs
- CorePropertiesFilter.cs
- TextAutomationPeer.cs
- JavaScriptString.cs
- XmlElementCollection.cs
- PhonemeConverter.cs
- SQLMembershipProvider.cs
- OleDbRowUpdatedEvent.cs
- StandardOleMarshalObject.cs
- ZipIORawDataFileBlock.cs
- DashStyle.cs
- UTF7Encoding.cs
- FlowDocumentView.cs
- SetStateDesigner.cs
- log.cs
- PointIndependentAnimationStorage.cs
- ViewLoader.cs
- MailFileEditor.cs
- ForceCopyBuildProvider.cs
- RegexCompilationInfo.cs
- ProgressBarRenderer.cs
- WorkflowWebService.cs
- ExpressionParser.cs
- DataRowComparer.cs
- OdbcError.cs
- ToolStripGrip.cs
- HandlerFactoryCache.cs
- UpdateProgress.cs
- LayoutEngine.cs
- CompileLiteralTextParser.cs
- Literal.cs
- GradientBrush.cs
- HandlerFactoryWrapper.cs
- TextElementEnumerator.cs
- MarkupCompilePass2.cs
- TripleDESCryptoServiceProvider.cs
- RightNameExpirationInfoPair.cs
- DesignerTransaction.cs
- DesignerDataTable.cs
- NumericExpr.cs
- AnimationStorage.cs
- TransformedBitmap.cs
- TableLayoutSettings.cs
- ReliableReplySessionChannel.cs
- ListSortDescriptionCollection.cs
- RegisteredDisposeScript.cs
- OLEDB_Util.cs
- SqlConnectionFactory.cs
- BackStopAuthenticationModule.cs
- UndirectedGraph.cs
- BaseCodeDomTreeGenerator.cs
- InertiaExpansionBehavior.cs
- BasicSecurityProfileVersion.cs
- FilteredDataSetHelper.cs
- UdpDiscoveryMessageFilter.cs
- XmlDownloadManager.cs
- StateDesigner.cs
- SqlParameterCollection.cs
- SoapSchemaExporter.cs
- ExecutionEngineException.cs
- TreeViewItemAutomationPeer.cs
- ReadOnlyMetadataCollection.cs
- ValidationHelpers.cs
- ColorIndependentAnimationStorage.cs
- XamlSerializationHelper.cs
- GeometryHitTestResult.cs
- ToolbarAUtomationPeer.cs
- HotCommands.cs
- SafeNativeMethods.cs
- StorageScalarPropertyMapping.cs
- OutputCacheSettingsSection.cs
- XmlQueryCardinality.cs
- TextBlock.cs
- CodeCompiler.cs
- TimeZone.cs
- HttpCachePolicyElement.cs
- RecognizedPhrase.cs
- FirstMatchCodeGroup.cs
- IntSecurity.cs