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
- KnownIds.cs
- PromptEventArgs.cs
- DiscoveryMessageSequenceCD1.cs
- shaperfactoryquerycacheentry.cs
- SoapReflectionImporter.cs
- TextRunCache.cs
- InkSerializer.cs
- XmlValueConverter.cs
- ConfigPathUtility.cs
- TextFormatterContext.cs
- DecoderFallback.cs
- HtmlGenericControl.cs
- ListViewGroup.cs
- CheckBoxList.cs
- HttpWebRequest.cs
- WriteTimeStream.cs
- ListViewDeletedEventArgs.cs
- VirtualPathProvider.cs
- SqlDataSourceRefreshSchemaForm.cs
- ClientEventManager.cs
- EncryptedKeyIdentifierClause.cs
- HttpListenerResponse.cs
- RegistryKey.cs
- EntityProxyFactory.cs
- CultureNotFoundException.cs
- ContractNamespaceAttribute.cs
- BitmapMetadataBlob.cs
- PersistChildrenAttribute.cs
- IDispatchConstantAttribute.cs
- ConfigXmlReader.cs
- XmlChoiceIdentifierAttribute.cs
- Buffer.cs
- PasswordTextNavigator.cs
- HMACSHA256.cs
- CommandBinding.cs
- PromptEventArgs.cs
- CssTextWriter.cs
- FontStyle.cs
- PackagePartCollection.cs
- SqlDataSourceSummaryPanel.cs
- ProjectionPath.cs
- TextServicesCompartment.cs
- XmlSchemaAny.cs
- BindingMAnagerBase.cs
- TreeView.cs
- BufferBuilder.cs
- XmlIterators.cs
- XmlCharType.cs
- ConnectionPool.cs
- LoadedOrUnloadedOperation.cs
- TypeInformation.cs
- TransactionOptions.cs
- AssemblyBuilder.cs
- KeyedCollection.cs
- OperationResponse.cs
- HuffmanTree.cs
- CompoundFileStorageReference.cs
- DiscoveryDocumentLinksPattern.cs
- SoapInteropTypes.cs
- UrlMappingsSection.cs
- MultiPageTextView.cs
- Visual3D.cs
- SqlTypeConverter.cs
- hebrewshape.cs
- DataControlPagerLinkButton.cs
- Viewport3DAutomationPeer.cs
- DbSource.cs
- Tool.cs
- StrokeNodeData.cs
- SimplePropertyEntry.cs
- FileSystemInfo.cs
- PasswordRecovery.cs
- XsdDateTime.cs
- JoinCqlBlock.cs
- ForeignConstraint.cs
- ScriptHandlerFactory.cs
- XhtmlBasicImageAdapter.cs
- ProcessRequestArgs.cs
- SqlConnectionManager.cs
- CoTaskMemSafeHandle.cs
- RedirectionProxy.cs
- LinearKeyFrames.cs
- XmlNodeList.cs
- TemplateBindingExpressionConverter.cs
- BitmapVisualManager.cs
- CodeDirectoryCompiler.cs
- EditingCoordinator.cs
- IDQuery.cs
- ConditionalAttribute.cs
- Main.cs
- LabelDesigner.cs
- handlecollector.cs
- DataError.cs
- SQLBinaryStorage.cs
- XPathNodeHelper.cs
- MaskInputRejectedEventArgs.cs
- DataGridBeginningEditEventArgs.cs
- SqlConnectionHelper.cs
- TextBoxRenderer.cs
- oledbmetadatacolumnnames.cs