Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Base / MS / Internal / IO / Packaging / CaseInsensitiveOrdinalStringComparer.cs / 1 / 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: younggk: 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. //------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // Common container-related operations that can be shared among internal // components. // // History: // 02/17/2006: younggk: 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
- ZeroOpNode.cs
- InstancePersistenceCommand.cs
- PointConverter.cs
- WindowsRichEdit.cs
- Style.cs
- FormViewCommandEventArgs.cs
- AsynchronousChannel.cs
- LinqDataSourceInsertEventArgs.cs
- MetadataCache.cs
- ZipIOExtraFieldElement.cs
- FolderBrowserDialogDesigner.cs
- ByteFacetDescriptionElement.cs
- UnsafeNativeMethods.cs
- UnauthorizedWebPart.cs
- documentsequencetextcontainer.cs
- RegexParser.cs
- FileLevelControlBuilderAttribute.cs
- BamlResourceDeserializer.cs
- TdsParserSafeHandles.cs
- Helpers.cs
- SatelliteContractVersionAttribute.cs
- SimpleHandlerBuildProvider.cs
- NameService.cs
- TextSearch.cs
- SRef.cs
- DefaultTraceListener.cs
- TextTreeRootNode.cs
- ExpressionPrinter.cs
- KeyNotFoundException.cs
- FacetEnabledSchemaElement.cs
- _NegoStream.cs
- TextEffectResolver.cs
- HttpHandlerActionCollection.cs
- NetCodeGroup.cs
- UnicastIPAddressInformationCollection.cs
- QueryCacheManager.cs
- _NTAuthentication.cs
- TabControl.cs
- CorrelationManager.cs
- PipelineComponent.cs
- RefreshEventArgs.cs
- NonVisualControlAttribute.cs
- RegexCharClass.cs
- KnownBoxes.cs
- basecomparevalidator.cs
- Vector.cs
- SessionEndedEventArgs.cs
- ChtmlCommandAdapter.cs
- TemplatedWizardStep.cs
- ToolStripPanelRow.cs
- WebHttpBinding.cs
- Rotation3DAnimation.cs
- QilVisitor.cs
- ping.cs
- ObjectDataSourceStatusEventArgs.cs
- EntityWithKeyStrategy.cs
- ConfigurationValues.cs
- BCLDebug.cs
- RequestStatusBarUpdateEventArgs.cs
- ValueType.cs
- CodeCatchClauseCollection.cs
- Content.cs
- TimerElapsedEvenArgs.cs
- ReaderWriterLockWrapper.cs
- PaginationProgressEventArgs.cs
- HostingMessageProperty.cs
- FamilyTypeface.cs
- NetTcpBindingCollectionElement.cs
- RouteValueExpressionBuilder.cs
- ConstrainedGroup.cs
- WebHttpBindingElement.cs
- CodeExpressionStatement.cs
- SpotLight.cs
- RawStylusInputReport.cs
- VisualTreeUtils.cs
- RegexCharClass.cs
- OpacityConverter.cs
- FormViewDesigner.cs
- XmlSchemaRedefine.cs
- AddInAdapter.cs
- CallbackHandler.cs
- AttributeEmitter.cs
- ImportStoreException.cs
- ActiveXHost.cs
- ExpressionReplacer.cs
- PKCS1MaskGenerationMethod.cs
- RemotingServices.cs
- ImmutableCommunicationTimeouts.cs
- EntitySetDataBindingList.cs
- HttpModulesSection.cs
- UrlPropertyAttribute.cs
- DetailsViewDeletedEventArgs.cs
- EdgeProfileValidation.cs
- DataServiceContext.cs
- TextRunTypographyProperties.cs
- ListItemConverter.cs
- MetadataProperty.cs
- BaseAppDomainProtocolHandler.cs
- SystemResourceKey.cs
- DeviceSpecific.cs