Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / 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.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConfigXmlWhitespace.cs
- SqlCachedBuffer.cs
- SmtpAuthenticationManager.cs
- Point3DAnimationUsingKeyFrames.cs
- UrlAuthorizationModule.cs
- MethodExpr.cs
- IPGlobalProperties.cs
- AddInPipelineAttributes.cs
- XmlSchemaFacet.cs
- EntityDataSourceEntityTypeFilterItem.cs
- CodeDomConfigurationHandler.cs
- ObjectListFieldCollection.cs
- SQLSingle.cs
- cookiecontainer.cs
- InputLanguageSource.cs
- MarkupCompilePass2.cs
- SqlError.cs
- QueryResponse.cs
- ObjectItemCollection.cs
- SqlIdentifier.cs
- WebPartExportVerb.cs
- ControlPersister.cs
- SqlCommandBuilder.cs
- CodeArgumentReferenceExpression.cs
- Token.cs
- SpanIndex.cs
- NonBatchDirectoryCompiler.cs
- ButtonField.cs
- EventProviderWriter.cs
- DataControlFieldCell.cs
- PageCatalogPartDesigner.cs
- HttpErrorTraceRecord.cs
- HelpKeywordAttribute.cs
- ReadOnlyDictionary.cs
- XmlFormatExtensionPointAttribute.cs
- WindowsSlider.cs
- TreeViewCancelEvent.cs
- MemberJoinTreeNode.cs
- ObjectSerializerFactory.cs
- MimeWriter.cs
- MemoryStream.cs
- CustomCredentialPolicy.cs
- XhtmlBasicValidationSummaryAdapter.cs
- IndentTextWriter.cs
- MemberAssignmentAnalysis.cs
- InheritanceAttribute.cs
- webproxy.cs
- HttpHeaderCollection.cs
- AsyncDataRequest.cs
- CustomWebEventKey.cs
- PerformanceCounterPermissionEntry.cs
- TraceFilter.cs
- BridgeDataRecord.cs
- AnimationLayer.cs
- Char.cs
- ResourceDisplayNameAttribute.cs
- GridLengthConverter.cs
- Underline.cs
- ChannelPoolSettingsElement.cs
- SafeFindHandle.cs
- String.cs
- Underline.cs
- FixedTextView.cs
- ReceiveCompletedEventArgs.cs
- BCLDebug.cs
- ComponentFactoryHelpers.cs
- Ipv6Element.cs
- Char.cs
- MatrixIndependentAnimationStorage.cs
- NativeStructs.cs
- SqlInternalConnectionSmi.cs
- CapiSafeHandles.cs
- SettingsProperty.cs
- HashCodeCombiner.cs
- HtmlShimManager.cs
- WindowsListBox.cs
- KeysConverter.cs
- QilChoice.cs
- SelectorAutomationPeer.cs
- HttpResponseWrapper.cs
- DataGridBoolColumn.cs
- RealizationContext.cs
- InvokePattern.cs
- ResourceSet.cs
- KerberosRequestorSecurityToken.cs
- LinqDataSourceEditData.cs
- FilterRepeater.cs
- TextChange.cs
- WebPartDescriptionCollection.cs
- DesignTimeType.cs
- ViewManager.cs
- BinaryConverter.cs
- HttpRuntime.cs
- XPathDocumentNavigator.cs
- IndexedGlyphRun.cs
- PolicyLevel.cs
- WrapPanel.cs
- OperandQuery.cs
- ClientSettingsProvider.cs
- WorkflowMarkupElementEventArgs.cs