Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / 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.] ///// 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
- DataGridViewLinkCell.cs
- CreateUserWizardStep.cs
- LogExtent.cs
- GeneralTransform3DTo2D.cs
- TemplateKey.cs
- ControlParser.cs
- InputProviderSite.cs
- RSACryptoServiceProvider.cs
- WindowsSpinner.cs
- ScriptingWebServicesSectionGroup.cs
- TagMapInfo.cs
- ViewBox.cs
- ValidationEventArgs.cs
- DiscoveryClientChannelFactory.cs
- DataContractSerializerOperationGenerator.cs
- ProcessModelSection.cs
- TypefaceMap.cs
- IDispatchConstantAttribute.cs
- HttpCachePolicyWrapper.cs
- DynamicValidatorEventArgs.cs
- ComponentEvent.cs
- LiteralTextParser.cs
- Image.cs
- ComplexTypeEmitter.cs
- ComplexLine.cs
- StreamWriter.cs
- XmlText.cs
- SrgsElementList.cs
- SectionInput.cs
- DocumentAutomationPeer.cs
- FormsAuthenticationCredentials.cs
- MissingMethodException.cs
- CompensationToken.cs
- Brush.cs
- BlurBitmapEffect.cs
- NullableLongAverageAggregationOperator.cs
- FontStyleConverter.cs
- TemplatedMailWebEventProvider.cs
- HttpModulesInstallComponent.cs
- ScriptControlDescriptor.cs
- TwoPhaseCommit.cs
- ProgressBar.cs
- LoadedOrUnloadedOperation.cs
- TabItemWrapperAutomationPeer.cs
- SQLDecimalStorage.cs
- CallId.cs
- BamlResourceSerializer.cs
- SynchronizedInputHelper.cs
- PrintingPermissionAttribute.cs
- DataServiceBehavior.cs
- StateInitialization.cs
- InstanceLockedException.cs
- PersonalizationState.cs
- SecurityRuntime.cs
- Package.cs
- TrustLevelCollection.cs
- SchemaLookupTable.cs
- COM2AboutBoxPropertyDescriptor.cs
- VideoDrawing.cs
- NullableFloatSumAggregationOperator.cs
- CanonicalFontFamilyReference.cs
- UnsafeNativeMethods.cs
- TraceSection.cs
- ToolStripContainer.cs
- NotSupportedException.cs
- AttributeCollection.cs
- bidPrivateBase.cs
- QueryOutputWriterV1.cs
- Ticks.cs
- AssemblyName.cs
- CngProvider.cs
- _ContextAwareResult.cs
- StreamGeometry.cs
- DataListItemCollection.cs
- UseAttributeSetsAction.cs
- PreApplicationStartMethodAttribute.cs
- SymbolEqualComparer.cs
- ValueExpressions.cs
- DeploymentSection.cs
- AddInToken.cs
- FileUpload.cs
- ChangePasswordDesigner.cs
- EpmTargetPathSegment.cs
- UnsafeNativeMethods.cs
- TraceInternal.cs
- XmlnsDictionary.cs
- StringFormat.cs
- DataTableReaderListener.cs
- SwitchLevelAttribute.cs
- ReadOnlyCollectionBase.cs
- BasicViewGenerator.cs
- WsatServiceAddress.cs
- ExceptionAggregator.cs
- ThrowHelper.cs
- PasswordTextNavigator.cs
- StorageComplexPropertyMapping.cs
- ListViewInsertionMark.cs
- TextRangeBase.cs
- ResourceDictionary.cs
- AlignmentXValidation.cs