Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. //------------------------------------------------------------------------------ //[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.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AssociationTypeEmitter.cs
- StagingAreaInputItem.cs
- BypassElement.cs
- CodeTypeOfExpression.cs
- RegexWorker.cs
- Code.cs
- HostedController.cs
- SendMailErrorEventArgs.cs
- DynamicDiscoveryDocument.cs
- TypeBinaryExpression.cs
- TimeIntervalCollection.cs
- DataControlCommands.cs
- ScrollChangedEventArgs.cs
- DataRowView.cs
- AnnotationDocumentPaginator.cs
- XappLauncher.cs
- SoundPlayer.cs
- RightsManagementEncryptionTransform.cs
- ChangeDirector.cs
- ActionItem.cs
- FormParameter.cs
- _LoggingObject.cs
- TemplateXamlParser.cs
- BooleanAnimationUsingKeyFrames.cs
- Point3DCollection.cs
- Transform3DGroup.cs
- SecurityKeyIdentifier.cs
- TransmissionStrategy.cs
- ClickablePoint.cs
- FixedTextBuilder.cs
- Select.cs
- TraceProvider.cs
- PerformanceCounterManager.cs
- ArrayWithOffset.cs
- PersistenceProviderFactory.cs
- DebugView.cs
- TextRenderer.cs
- HttpRuntime.cs
- ScriptControlDescriptor.cs
- ClearCollection.cs
- DesignerActionPropertyItem.cs
- Module.cs
- IsolatedStorageFileStream.cs
- TraceHandler.cs
- SectionUpdates.cs
- DataGridViewToolTip.cs
- DataGridViewCellCancelEventArgs.cs
- ResolvedKeyFrameEntry.cs
- PersonalizationState.cs
- PreviewKeyDownEventArgs.cs
- ArraySegment.cs
- CallbackHandler.cs
- CodeMemberMethod.cs
- LineServicesCallbacks.cs
- PageCatalogPart.cs
- StrokeNodeOperations2.cs
- ErrorHandler.cs
- TriState.cs
- SessionEndingEventArgs.cs
- HttpPostedFile.cs
- ListBoxItemAutomationPeer.cs
- ListBoxItemAutomationPeer.cs
- LeftCellWrapper.cs
- BamlLocalizableResourceKey.cs
- HtmlInputCheckBox.cs
- SHA256.cs
- IisTraceWebEventProvider.cs
- ProcessHost.cs
- CdpEqualityComparer.cs
- WarningException.cs
- VerificationException.cs
- ThreadStateException.cs
- WebPartConnectionCollection.cs
- StyleXamlParser.cs
- GridViewUpdatedEventArgs.cs
- DbTransaction.cs
- UnsafeNativeMethods.cs
- HandlerFactoryCache.cs
- TypeConverter.cs
- DataExpression.cs
- OAVariantLib.cs
- DictionaryEntry.cs
- SafePointer.cs
- QilDataSource.cs
- XmlComplianceUtil.cs
- KeyboardNavigation.cs
- WhitespaceRuleReader.cs
- KeyboardNavigation.cs
- StatusBarDrawItemEvent.cs
- EventLogger.cs
- VirtualPathProvider.cs
- PenContext.cs
- ArrayElementGridEntry.cs
- AdPostCacheSubstitution.cs
- ServiceDescription.cs
- WindowInteropHelper.cs
- ButtonBase.cs
- XmlDictionaryReaderQuotas.cs
- TableRowCollection.cs
- SchemaEntity.cs