Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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; } } }[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebAdminConfigurationHelper.cs
- DynamicAttribute.cs
- GeneralTransform.cs
- MessagingDescriptionAttribute.cs
- SemanticAnalyzer.cs
- SessionStateModule.cs
- SoapSchemaImporter.cs
- SocketException.cs
- ClientConfigPaths.cs
- TypeDelegator.cs
- OdbcException.cs
- SamlSubjectStatement.cs
- FlowNode.cs
- BoundField.cs
- AliasGenerator.cs
- Mappings.cs
- RtfControlWordInfo.cs
- SByteStorage.cs
- ToolBarOverflowPanel.cs
- columnmapfactory.cs
- SoapAttributeOverrides.cs
- MouseEventArgs.cs
- StructuredTypeEmitter.cs
- CheckedPointers.cs
- safelink.cs
- WebBrowserContainer.cs
- BindingMemberInfo.cs
- ConfigurationStrings.cs
- SelectedGridItemChangedEvent.cs
- DataColumn.cs
- PageStatePersister.cs
- SoapObjectInfo.cs
- InputLanguageSource.cs
- XamlValidatingReader.cs
- GradientSpreadMethodValidation.cs
- ToolStripOverflowButton.cs
- DropShadowBitmapEffect.cs
- CharKeyFrameCollection.cs
- BitStream.cs
- OracleConnection.cs
- PeerPresenceInfo.cs
- ToolboxItemFilterAttribute.cs
- Matrix.cs
- ItemAutomationPeer.cs
- KeyToListMap.cs
- Signature.cs
- TypeConverter.cs
- EpmSyndicationContentSerializer.cs
- SqlMultiplexer.cs
- Int16Animation.cs
- PlainXmlWriter.cs
- DependencyPropertyConverter.cs
- CachedResourceDictionaryExtension.cs
- ProfessionalColors.cs
- CustomCategoryAttribute.cs
- DecimalAnimation.cs
- MenuItem.cs
- RelationshipDetailsRow.cs
- DeclarativeCatalogPart.cs
- SecurityPolicySection.cs
- X509RawDataKeyIdentifierClause.cs
- ApplicationProxyInternal.cs
- FormsIdentity.cs
- ViewBox.cs
- PrincipalPermission.cs
- OperationPickerDialog.designer.cs
- LineGeometry.cs
- AncestorChangedEventArgs.cs
- ColumnPropertiesGroup.cs
- DayRenderEvent.cs
- FacetDescription.cs
- StandardBindingElement.cs
- WorkflowInstanceExtensionProvider.cs
- IDReferencePropertyAttribute.cs
- TemplateBuilder.cs
- NodeCounter.cs
- OdbcTransaction.cs
- QilStrConcatenator.cs
- DelayedRegex.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- LinqDataSourceValidationException.cs
- EventSetter.cs
- TextElementEditingBehaviorAttribute.cs
- XmlIlVisitor.cs
- CoreSwitches.cs
- EmbossBitmapEffect.cs
- PathStreamGeometryContext.cs
- FakeModelItemImpl.cs
- PageBorderless.cs
- CompensationExtension.cs
- ReadOnlyMetadataCollection.cs
- ValidationSummary.cs
- ReliabilityContractAttribute.cs
- AmbientEnvironment.cs
- BamlTreeMap.cs
- SerialStream.cs
- AuthenticationManager.cs
- Normalization.cs
- Publisher.cs
- SoapServerProtocol.cs