Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / IO / Packaging / CaseInsensitiveOrdinalStringComparer.cs / 1305600 / CaseInsensitiveOrdinalStringComparer.cs
//------------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description:
// Common container-related operations that can be shared among internal
// components.
//
// History:
// 02/17/2006: [....]: Creation
//
//-----------------------------------------------------------------------------
using System;
using System.Collections; // for IEqualityComparer
using MS.Internal; // for Invariant.Assert
namespace MS.Internal.IO.Packaging
{
///
/// IEqualityComparer implementation for case insensistive ordinal strings
///
internal class CaseInsensitiveOrdinalStringComparer :
IEqualityComparer, IComparer
{
// Performs Case Insensitive Ordinal String Comparison.
bool IEqualityComparer.Equals(Object x, Object y)
{
Invariant.Assert((x is String) && (y is String));
return (String.CompareOrdinal(((String) x).ToUpperInvariant(),
((String) y).ToUpperInvariant()) == 0);
}
int IComparer.Compare(Object x, Object y)
{
Invariant.Assert((x is String) && (y is String));
return String.CompareOrdinal(((String) x).ToUpperInvariant(),
((String) y).ToUpperInvariant());
}
// Hash on object identity.
int IEqualityComparer.GetHashCode(Object str)
{
Invariant.Assert(str is String);
return ((String) str).ToUpperInvariant().GetHashCode();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XslTransform.cs
- Filter.cs
- ObjectViewFactory.cs
- XmlSchemaAttribute.cs
- TraceListener.cs
- SqlLiftIndependentRowExpressions.cs
- EntityDataSourceChangingEventArgs.cs
- PasswordRecovery.cs
- Attribute.cs
- HitTestFilterBehavior.cs
- GridToolTip.cs
- BmpBitmapDecoder.cs
- QueryOperator.cs
- PermissionToken.cs
- NullNotAllowedCollection.cs
- WindowsAltTab.cs
- SettingsPropertyIsReadOnlyException.cs
- SocketCache.cs
- ScriptingSectionGroup.cs
- Function.cs
- SqlMultiplexer.cs
- HttpHeaderCollection.cs
- InternalMappingException.cs
- IndicFontClient.cs
- cryptoapiTransform.cs
- EnumerableWrapperWeakToStrong.cs
- EncoderBestFitFallback.cs
- TableFieldsEditor.cs
- __Filters.cs
- ContextMenu.cs
- WsdlBuildProvider.cs
- InvokeWebService.cs
- Point4D.cs
- ZipFileInfoCollection.cs
- LockedHandleGlyph.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- WinFormsSecurity.cs
- IncrementalCompileAnalyzer.cs
- MILUtilities.cs
- CommonRemoteMemoryBlock.cs
- PeerNameRecordCollection.cs
- SerializerWriterEventHandlers.cs
- WriteTimeStream.cs
- AdCreatedEventArgs.cs
- DrawingImage.cs
- TryLoadRunnableWorkflowCommand.cs
- LogWriteRestartAreaAsyncResult.cs
- BackStopAuthenticationModule.cs
- _ChunkParse.cs
- parserscommon.cs
- IisHelper.cs
- SQLStringStorage.cs
- MasterPageCodeDomTreeGenerator.cs
- TextChange.cs
- ContractSearchPattern.cs
- CharStorage.cs
- PenLineJoinValidation.cs
- IdentitySection.cs
- TextBox.cs
- KnownTypesProvider.cs
- SchemaExporter.cs
- SvcMapFileLoader.cs
- WebPartVerbCollection.cs
- VisualStates.cs
- TemplateBuilder.cs
- ExtentCqlBlock.cs
- ArrangedElementCollection.cs
- XmlDocument.cs
- XMLDiffLoader.cs
- XamlRtfConverter.cs
- ErrorHandler.cs
- MouseWheelEventArgs.cs
- WebPartConnectionsCancelVerb.cs
- WebRequestModuleElementCollection.cs
- UTF7Encoding.cs
- HtmlTableRow.cs
- AudioBase.cs
- ADMembershipUser.cs
- DataViewSettingCollection.cs
- Msec.cs
- OperationInvokerTrace.cs
- SimpleFieldTemplateFactory.cs
- ImmutablePropertyDescriptorGridEntry.cs
- PaintValueEventArgs.cs
- LongValidatorAttribute.cs
- CompressEmulationStream.cs
- SessionStateContainer.cs
- CqlLexerHelpers.cs
- FigureParaClient.cs
- QueryConverter.cs
- SqlProfileProvider.cs
- ProviderConnectionPointCollection.cs
- NetworkAddressChange.cs
- _NegoState.cs
- ListSourceHelper.cs
- RuleElement.cs
- ECDiffieHellmanCng.cs
- PageCatalogPart.cs
- ProtectedConfiguration.cs