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
- ModulesEntry.cs
- PermissionToken.cs
- FreeFormDragDropManager.cs
- Validator.cs
- NopReturnReader.cs
- DerivedKeySecurityTokenStub.cs
- DummyDataSource.cs
- DocumentPageViewAutomationPeer.cs
- NumericUpDown.cs
- JournalNavigationScope.cs
- ProviderSettings.cs
- Rotation3D.cs
- UnsafeNativeMethods.cs
- CustomGrammar.cs
- InvalidCastException.cs
- RelationshipWrapper.cs
- DrawToolTipEventArgs.cs
- StdValidatorsAndConverters.cs
- CodeVariableReferenceExpression.cs
- UriTemplateCompoundPathSegment.cs
- MessageQueue.cs
- ProviderConnectionPoint.cs
- ExpressionStringBuilder.cs
- EntityViewContainer.cs
- ObjectDataSourceStatusEventArgs.cs
- externdll.cs
- BaseTemplateCodeDomTreeGenerator.cs
- BaseHashHelper.cs
- OptimizedTemplateContentHelper.cs
- WindowPattern.cs
- RemotingConfiguration.cs
- XhtmlTextWriter.cs
- ThicknessAnimation.cs
- SmtpNtlmAuthenticationModule.cs
- ScrollChrome.cs
- SystemIPInterfaceProperties.cs
- MenuAutomationPeer.cs
- OracleConnectionString.cs
- BrowserDefinitionCollection.cs
- NullableFloatMinMaxAggregationOperator.cs
- SynchronizedDisposablePool.cs
- Module.cs
- ContextMenuStrip.cs
- IISUnsafeMethods.cs
- TextBoxAutomationPeer.cs
- DataGridViewMethods.cs
- CharStorage.cs
- SQLMoneyStorage.cs
- DbCommandDefinition.cs
- CornerRadiusConverter.cs
- DetailsView.cs
- XmlDocumentFragment.cs
- FileDialog.cs
- OdbcParameter.cs
- TraceHandlerErrorFormatter.cs
- StylusPointCollection.cs
- StatusBarPanelClickEvent.cs
- MaskInputRejectedEventArgs.cs
- ObjectStateManagerMetadata.cs
- CatalogPart.cs
- UndoUnit.cs
- CompilerCollection.cs
- TraceContext.cs
- ResourcesBuildProvider.cs
- __ComObject.cs
- SByteStorage.cs
- SetStoryboardSpeedRatio.cs
- DependencyProperty.cs
- XamlInt32CollectionSerializer.cs
- SchemaContext.cs
- RequestQueryProcessor.cs
- SqlMetaData.cs
- ValidatingPropertiesEventArgs.cs
- SimpleWebHandlerParser.cs
- ListControl.cs
- TextTrailingWordEllipsis.cs
- PolicyException.cs
- ProxyManager.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- VirtualPathProvider.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- CorrelationManager.cs
- SortKey.cs
- DocumentOrderComparer.cs
- URLMembershipCondition.cs
- HyperLinkColumn.cs
- DataView.cs
- AttachedPropertyDescriptor.cs
- Double.cs
- ProtocolElementCollection.cs
- storepermission.cs
- CodeGenerator.cs
- ValidatorUtils.cs
- MouseEvent.cs
- HttpValueCollection.cs
- SQLBoolean.cs
- documentsequencetextview.cs
- InternalControlCollection.cs
- BitmapVisualManager.cs
- SystemTcpConnection.cs