Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- WindowsFormsHelpers.cs
- JournalNavigationScope.cs
- UnsafeNativeMethods.cs
- ExtenderControl.cs
- InternalBufferOverflowException.cs
- IisTraceWebEventProvider.cs
- BulletChrome.cs
- CellConstant.cs
- BoolExpression.cs
- GridPattern.cs
- EntityDataSourceMemberPath.cs
- SmiSettersStream.cs
- DataRelationPropertyDescriptor.cs
- Soap12ServerProtocol.cs
- TriggerAction.cs
- PropertyChangeTracker.cs
- BasicExpressionVisitor.cs
- SelectorAutomationPeer.cs
- TextDecorationCollection.cs
- EditingScope.cs
- HttpResponseBase.cs
- FtpWebRequest.cs
- TreeNodeConverter.cs
- TreeNodeCollectionEditor.cs
- ValidationRuleCollection.cs
- DataTableExtensions.cs
- PrivilegeNotHeldException.cs
- Keywords.cs
- HtmlEmptyTagControlBuilder.cs
- KeyboardNavigation.cs
- TypeBuilderInstantiation.cs
- TextServicesDisplayAttribute.cs
- SafeRightsManagementPubHandle.cs
- CodeEntryPointMethod.cs
- HttpPostLocalhostServerProtocol.cs
- WindowsSolidBrush.cs
- InstanceStore.cs
- CompiledAction.cs
- SplitContainerDesigner.cs
- DSACryptoServiceProvider.cs
- HtmlInputControl.cs
- ExtendedProperty.cs
- Peer.cs
- WebPartDisplayMode.cs
- CodeCompileUnit.cs
- CustomError.cs
- OverlappedContext.cs
- PropertyValueEditor.cs
- XPathCompileException.cs
- XamlPathDataSerializer.cs
- DesignBindingValueUIHandler.cs
- ButtonDesigner.cs
- EditorZone.cs
- SourceElementsCollection.cs
- RequiredAttributeAttribute.cs
- _TLSstream.cs
- TrackingProfileSerializer.cs
- PrintDocument.cs
- PriorityItem.cs
- ButtonColumn.cs
- SmiEventSink_Default.cs
- LinqDataSourceView.cs
- XmlQualifiedName.cs
- HwndProxyElementProvider.cs
- RayHitTestParameters.cs
- precedingsibling.cs
- CmsUtils.cs
- SafeNativeMemoryHandle.cs
- AnnotationComponentManager.cs
- NoResizeSelectionBorderGlyph.cs
- HeaderedItemsControl.cs
- QuaternionRotation3D.cs
- UnsafeNativeMethods.cs
- MessageQueueTransaction.cs
- RelatedPropertyManager.cs
- SerialStream.cs
- CodeMemberMethod.cs
- DataGridViewRowHeaderCell.cs
- ParenExpr.cs
- MenuItemStyle.cs
- Merger.cs
- Subtree.cs
- RadioButtonRenderer.cs
- TextAdaptor.cs
- WebServiceData.cs
- XslCompiledTransform.cs
- PauseStoryboard.cs
- Rules.cs
- XmlSchemaSequence.cs
- ListViewCommandEventArgs.cs
- BitmapVisualManager.cs
- DummyDataSource.cs
- HttpProfileGroupBase.cs
- QueryCursorEventArgs.cs
- XmlSchemaValidator.cs
- MeasureItemEvent.cs
- UdpDuplexChannel.cs
- IsolatedStorage.cs
- ItemCheckedEvent.cs
- LocalFileSettingsProvider.cs