Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- SHA512Managed.cs
- SolidColorBrush.cs
- PrintDocument.cs
- BamlReader.cs
- ActiveDocumentEvent.cs
- BrowserInteropHelper.cs
- FrameworkElementFactory.cs
- AnimationClock.cs
- SimpleType.cs
- ConstraintStruct.cs
- DataMemberConverter.cs
- MatrixCamera.cs
- RowCache.cs
- BoolExpressionVisitors.cs
- XmlQueryType.cs
- Help.cs
- StringFreezingAttribute.cs
- ReflectionUtil.cs
- X509Certificate2.cs
- ToolStripManager.cs
- DataSourceProvider.cs
- ImageMetadata.cs
- DbParameterCollection.cs
- ParentQuery.cs
- QueueException.cs
- WpfWebRequestHelper.cs
- GraphicsContainer.cs
- ServiceHostingEnvironmentSection.cs
- DataGridHeaderBorder.cs
- TrustLevel.cs
- AdPostCacheSubstitution.cs
- LongTypeConverter.cs
- CheckBoxStandardAdapter.cs
- DbProviderFactoriesConfigurationHandler.cs
- AppDomainUnloadedException.cs
- NativeDirectoryServicesQueryAPIs.cs
- BuildManagerHost.cs
- MissingFieldException.cs
- MemoryFailPoint.cs
- TreeView.cs
- ScrollData.cs
- SiteMapProvider.cs
- StylusPoint.cs
- ResourceDictionary.cs
- RectangleF.cs
- BaseComponentEditor.cs
- Msec.cs
- RuntimeHelpers.cs
- TdsParser.cs
- Memoizer.cs
- IdentityReference.cs
- ApplicationSecurityManager.cs
- XPathExpr.cs
- EraserBehavior.cs
- ToolboxCategoryItems.cs
- Tokenizer.cs
- FileUtil.cs
- BaseTemplateCodeDomTreeGenerator.cs
- TypeBinaryExpression.cs
- KeyEvent.cs
- NamedPipeProcessProtocolHandler.cs
- GradientStopCollection.cs
- ObjectTag.cs
- ObjectViewEntityCollectionData.cs
- Ref.cs
- ObjectDataSourceStatusEventArgs.cs
- WeakReferenceList.cs
- TypedTableBaseExtensions.cs
- DataGridViewCellCancelEventArgs.cs
- IInstanceTable.cs
- RequestTimeoutManager.cs
- AssemblyAttributesGoHere.cs
- XPathNodePointer.cs
- PrivilegedConfigurationManager.cs
- GroupJoinQueryOperator.cs
- CustomPopupPlacement.cs
- WsdlBuildProvider.cs
- SafeProcessHandle.cs
- XmlCharCheckingReader.cs
- streamingZipPartStream.cs
- Int32Rect.cs
- PropertyGeneratedEventArgs.cs
- WindowsEditBoxRange.cs
- SystemException.cs
- BorderGapMaskConverter.cs
- _TransmitFileOverlappedAsyncResult.cs
- Events.cs
- HtmlElementErrorEventArgs.cs
- Intellisense.cs
- HttpConfigurationSystem.cs
- FixedNode.cs
- GeneratedView.cs
- Paragraph.cs
- SettingsPropertyValueCollection.cs
- UnsafeNetInfoNativeMethods.cs
- TraceShell.cs
- MarkupProperty.cs
- NotifyParentPropertyAttribute.cs
- ListViewEditEventArgs.cs
- MetadataHelper.cs