Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- ToggleProviderWrapper.cs
- MinimizableAttributeTypeConverter.cs
- PluralizationService.cs
- Rect3D.cs
- GenerateScriptTypeAttribute.cs
- Style.cs
- SQLStringStorage.cs
- OdbcEnvironmentHandle.cs
- RijndaelManaged.cs
- Pool.cs
- SlotInfo.cs
- ButtonColumn.cs
- DataObjectCopyingEventArgs.cs
- InputMethodStateTypeInfo.cs
- XmlDataContract.cs
- DataGridSortCommandEventArgs.cs
- Rotation3DAnimation.cs
- SystemMulticastIPAddressInformation.cs
- XPathNodeIterator.cs
- DiscoveryServerProtocol.cs
- handlecollector.cs
- IdleTimeoutMonitor.cs
- DataRowComparer.cs
- NativeActivityFaultContext.cs
- TextWriterEngine.cs
- OpenFileDialog.cs
- ErrorsHelper.cs
- FixedBufferAttribute.cs
- SystemException.cs
- SecurityContext.cs
- AttachedProperty.cs
- CollectionTypeElement.cs
- List.cs
- QueryParameter.cs
- SqlCacheDependencyDatabaseCollection.cs
- SharedStatics.cs
- AppDomainUnloadedException.cs
- TextInfo.cs
- CompositeFontInfo.cs
- DesignerActionMethodItem.cs
- EdmToObjectNamespaceMap.cs
- XamlSerializationHelper.cs
- StrongTypingException.cs
- RequestTimeoutManager.cs
- Base64Decoder.cs
- CodeThrowExceptionStatement.cs
- Parameter.cs
- MenuRendererStandards.cs
- PartitionerQueryOperator.cs
- RightsManagementProvider.cs
- PartialCachingControl.cs
- DiscoveryMessageSequence.cs
- TypeDescriptionProviderAttribute.cs
- TextEditorCharacters.cs
- SecurityUtils.cs
- LineSegment.cs
- GC.cs
- DefaultBindingPropertyAttribute.cs
- xsdvalidator.cs
- DecoderFallback.cs
- ToolStripManager.cs
- PropertyReference.cs
- PrincipalPermissionMode.cs
- ErrorStyle.cs
- ChtmlTextWriter.cs
- DataGridSortCommandEventArgs.cs
- EventLogPermissionHolder.cs
- AssemblyName.cs
- StickyNoteAnnotations.cs
- IdentityNotMappedException.cs
- HiddenFieldPageStatePersister.cs
- RecognizedWordUnit.cs
- FormsAuthenticationConfiguration.cs
- AppManager.cs
- AggregateException.cs
- IndexedEnumerable.cs
- ContainerVisual.cs
- Blend.cs
- TimeSpanSecondsConverter.cs
- EncryptedKey.cs
- RemoteWebConfigurationHost.cs
- OutputWindow.cs
- ChameleonKey.cs
- DaylightTime.cs
- RangeExpression.cs
- RepeaterItemEventArgs.cs
- DataGridItemEventArgs.cs
- TypeExtensions.cs
- FrameworkElementFactory.cs
- PropertyInformation.cs
- WinFormsSecurity.cs
- XmlSchemaNotation.cs
- ErrorFormatterPage.cs
- TrustSection.cs
- TrustManagerMoreInformation.cs
- Table.cs
- ProtocolsConfigurationEntry.cs
- ScalarType.cs
- WebZone.cs
- ToolStripRenderEventArgs.cs