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
- RawKeyboardInputReport.cs
- safelinkcollection.cs
- XpsSerializationException.cs
- TextEncodedRawTextWriter.cs
- AndCondition.cs
- DbModificationClause.cs
- InheritanceContextChangedEventManager.cs
- FtpWebResponse.cs
- TableAdapterManagerGenerator.cs
- DataGridViewCellStyle.cs
- XmlSchemaValidationException.cs
- GridViewDeleteEventArgs.cs
- CLSCompliantAttribute.cs
- SortDescriptionCollection.cs
- CodeParameterDeclarationExpression.cs
- SchemaImporter.cs
- TaskFileService.cs
- AppDomainUnloadedException.cs
- SmiEventSink.cs
- MessageBox.cs
- DataColumnMappingCollection.cs
- SqlMethodAttribute.cs
- TableAdapterManagerMethodGenerator.cs
- Group.cs
- SrgsText.cs
- WebRequestModuleElementCollection.cs
- WrappedKeySecurityToken.cs
- DeploymentSectionCache.cs
- PathTooLongException.cs
- FormsIdentity.cs
- BaseTemplateCodeDomTreeGenerator.cs
- LogExtentCollection.cs
- RuntimeConfigurationRecord.cs
- ExpressionDumper.cs
- FlowDocumentReaderAutomationPeer.cs
- EventManager.cs
- TextServicesCompartmentContext.cs
- DoubleStorage.cs
- RelatedCurrencyManager.cs
- HostProtectionException.cs
- CrossSiteScriptingValidation.cs
- SmtpTransport.cs
- WindowProviderWrapper.cs
- PackageFilter.cs
- MenuCommands.cs
- IERequestCache.cs
- LineUtil.cs
- SecurityHeader.cs
- System.Data.OracleClient_BID.cs
- BlurEffect.cs
- LogicalExpr.cs
- EllipseGeometry.cs
- OdbcFactory.cs
- GraphicsPath.cs
- ValueProviderWrapper.cs
- VariantWrapper.cs
- EdmItemCollection.OcAssemblyCache.cs
- ScriptModule.cs
- PlainXmlWriter.cs
- DataServiceQueryException.cs
- ObjectHandle.cs
- ArithmeticException.cs
- StylusTip.cs
- MenuItemAutomationPeer.cs
- MD5CryptoServiceProvider.cs
- DataGridViewSortCompareEventArgs.cs
- ValidationResult.cs
- DataGridTextBox.cs
- ResizeGrip.cs
- CorrelationTokenInvalidatedHandler.cs
- DataSourceNameHandler.cs
- UnsafeNativeMethodsCLR.cs
- FtpWebResponse.cs
- X509DefaultServiceCertificateElement.cs
- OuterGlowBitmapEffect.cs
- contentDescriptor.cs
- MultiPropertyDescriptorGridEntry.cs
- ReachPageContentSerializer.cs
- TextSegment.cs
- DebugInfo.cs
- ACE.cs
- ResourceCollectionInfo.cs
- ExpandCollapsePatternIdentifiers.cs
- DesignTimeData.cs
- XPathSingletonIterator.cs
- RuleCache.cs
- _DisconnectOverlappedAsyncResult.cs
- KeyValuePairs.cs
- ThrowHelper.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- HtmlElementCollection.cs
- DelegatingChannelListener.cs
- ImmutableCollection.cs
- BindingExpression.cs
- X509CertificateClaimSet.cs
- CriticalHandle.cs
- EventBuilder.cs
- SoapElementAttribute.cs
- XmlReaderSettings.cs
- EventLogPermissionHolder.cs