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
- TdsParameterSetter.cs
- ExtendedPropertyDescriptor.cs
- X509InitiatorCertificateServiceElement.cs
- MobileControlBuilder.cs
- ZoneLinkButton.cs
- SocketElement.cs
- SourceFilter.cs
- printdlgexmarshaler.cs
- SpeechSeg.cs
- WebPartUserCapability.cs
- WebColorConverter.cs
- MultiTrigger.cs
- WebPartTracker.cs
- HiddenField.cs
- ParseElementCollection.cs
- WebHttpBinding.cs
- InkCanvasAutomationPeer.cs
- ColumnCollectionEditor.cs
- FrameworkObject.cs
- XPathSelfQuery.cs
- XmlCharCheckingWriter.cs
- AnimationClock.cs
- BoundingRectTracker.cs
- Accessible.cs
- DataServiceClientException.cs
- DetailsViewInsertEventArgs.cs
- ConfigXmlSignificantWhitespace.cs
- IsolatedStorageFile.cs
- SafeLocalMemHandle.cs
- ExtendedPropertyInfo.cs
- ProtocolElement.cs
- HttpsHostedTransportConfiguration.cs
- TextServicesHost.cs
- DispatcherHooks.cs
- DataColumnChangeEvent.cs
- GreenMethods.cs
- PlaceHolder.cs
- IPCCacheManager.cs
- METAHEADER.cs
- TypeNameHelper.cs
- ClaimTypeRequirement.cs
- XmlName.cs
- DbProviderSpecificTypePropertyAttribute.cs
- LeftCellWrapper.cs
- Typography.cs
- TextViewSelectionProcessor.cs
- PrintControllerWithStatusDialog.cs
- BrowserTree.cs
- EntityDataSourceView.cs
- UnwrappedTypesXmlSerializerManager.cs
- FactoryRecord.cs
- XPathSelfQuery.cs
- SchemaInfo.cs
- SplitterCancelEvent.cs
- DocumentScope.cs
- SEHException.cs
- WebFaultClientMessageInspector.cs
- CurrentChangedEventManager.cs
- BuildProvider.cs
- TransactionManager.cs
- ServiceOperationParameter.cs
- PageRequestManager.cs
- DataGridViewColumnConverter.cs
- HTMLTextWriter.cs
- XmlSerializerSection.cs
- SQLBinary.cs
- TextTreeInsertElementUndoUnit.cs
- HitTestWithGeometryDrawingContextWalker.cs
- ProbeDuplexCD1AsyncResult.cs
- DataGridTable.cs
- BaseParagraph.cs
- Win32MouseDevice.cs
- ClosableStream.cs
- SoapObjectInfo.cs
- InternalConfigRoot.cs
- VirtualPath.cs
- ClientOptions.cs
- ReaderContextStackData.cs
- PolicyValidationException.cs
- HelpEvent.cs
- StylusPointPropertyInfoDefaults.cs
- StrongNameSignatureInformation.cs
- RuleSetReference.cs
- CategoryNameCollection.cs
- DoubleKeyFrameCollection.cs
- InfoCardRSACryptoProvider.cs
- SchemaImporterExtensionElement.cs
- PropertyChangingEventArgs.cs
- QueueTransferProtocol.cs
- GuidTagList.cs
- Misc.cs
- TextTreeNode.cs
- Region.cs
- CodeObjectCreateExpression.cs
- SiteMapProvider.cs
- EntityDataSourceContainerNameConverter.cs
- DtdParser.cs
- autovalidator.cs
- PseudoWebRequest.cs
- SmiConnection.cs