Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- MatrixAnimationBase.cs
- XmlLanguage.cs
- AlternationConverter.cs
- KeyTimeConverter.cs
- CorrelationManager.cs
- ImpersonationContext.cs
- BlurBitmapEffect.cs
- EventItfInfo.cs
- ControlAdapter.cs
- PropertyInformationCollection.cs
- OutgoingWebRequestContext.cs
- AttributeProviderAttribute.cs
- TreeNodeStyle.cs
- StringFunctions.cs
- WebExceptionStatus.cs
- XmlDataSourceNodeDescriptor.cs
- RoleGroupCollectionEditor.cs
- RegisteredScript.cs
- CodeConstructor.cs
- ExceptionRoutedEventArgs.cs
- WorkflowInstance.cs
- GAC.cs
- columnmapkeybuilder.cs
- WrappingXamlSchemaContext.cs
- SelectionProviderWrapper.cs
- EventTask.cs
- RepeatInfo.cs
- AsyncCodeActivity.cs
- InvokePattern.cs
- GridProviderWrapper.cs
- ColumnWidthChangingEvent.cs
- ReadWriteObjectLock.cs
- PairComparer.cs
- ProtectedProviderSettings.cs
- EntityDataSourceChangedEventArgs.cs
- Privilege.cs
- ToolStripComboBox.cs
- InputScopeConverter.cs
- FlowLayout.cs
- XamlRtfConverter.cs
- LinkClickEvent.cs
- CryptoApi.cs
- PublisherIdentityPermission.cs
- TreeNodeBindingCollection.cs
- WindowInteropHelper.cs
- DbReferenceCollection.cs
- SqlNodeAnnotation.cs
- XmlDataSource.cs
- SecUtil.cs
- CultureSpecificCharacterBufferRange.cs
- GACIdentityPermission.cs
- SoapIncludeAttribute.cs
- DataRelationCollection.cs
- DirectionalAction.cs
- FacetValues.cs
- Form.cs
- InlinedAggregationOperatorEnumerator.cs
- RouteValueDictionary.cs
- ObjectResult.cs
- AttributeEmitter.cs
- DesigntimeLicenseContext.cs
- assemblycache.cs
- UsernameTokenFactoryCredential.cs
- ToolStripItemEventArgs.cs
- ConnectionPointCookie.cs
- Win32Exception.cs
- Pair.cs
- TypeConstant.cs
- DateTimeUtil.cs
- WebEvents.cs
- PrintController.cs
- AsymmetricSignatureFormatter.cs
- WizardStepCollectionEditor.cs
- JapaneseLunisolarCalendar.cs
- LinqMaximalSubtreeNominator.cs
- SpStreamWrapper.cs
- Soap12ServerProtocol.cs
- ArraySegment.cs
- AnnotationService.cs
- IdentityHolder.cs
- DetailsViewInsertedEventArgs.cs
- TransactionManager.cs
- WindowsAuthenticationEventArgs.cs
- EventLogHandle.cs
- DataError.cs
- FileAuthorizationModule.cs
- TextEffect.cs
- PrinterUnitConvert.cs
- DataGridRelationshipRow.cs
- Point3DAnimationUsingKeyFrames.cs
- CodeArrayIndexerExpression.cs
- SplineKeyFrames.cs
- Switch.cs
- ScopeElement.cs
- FullTextState.cs
- UnsafeNativeMethods.cs
- SelectionGlyphBase.cs
- MULTI_QI.cs
- XmlArrayItemAttribute.cs
- ToolBar.cs