Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ // //// 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
- Transform.cs
- DataGridColumn.cs
- SqlException.cs
- DataServiceCollectionOfT.cs
- TableProviderWrapper.cs
- ELinqQueryState.cs
- KeyValuePair.cs
- HtmlAnchor.cs
- SqlStatistics.cs
- MonthCalendar.cs
- ExtensionDataObject.cs
- PropertyStore.cs
- HostingPreferredMapPath.cs
- AvTraceFormat.cs
- LingerOption.cs
- UnauthorizedWebPart.cs
- SiteMapNodeItem.cs
- SqlTrackingWorkflowInstance.cs
- SchemaMerger.cs
- DataGridViewAddColumnDialog.cs
- DateTimeSerializationSection.cs
- DocumentApplication.cs
- TextViewBase.cs
- WebSysDisplayNameAttribute.cs
- StringExpressionSet.cs
- ObjectTag.cs
- CompositeFontParser.cs
- Setter.cs
- GiveFeedbackEvent.cs
- DeploymentSection.cs
- uribuilder.cs
- SQLMoneyStorage.cs
- DataGridParentRows.cs
- ScaleTransform3D.cs
- AffineTransform3D.cs
- SmtpNtlmAuthenticationModule.cs
- SwitchElementsCollection.cs
- ThemeableAttribute.cs
- UnsafeNativeMethods.cs
- XPathPatternParser.cs
- IntSecurity.cs
- ListBindingHelper.cs
- BinaryObjectReader.cs
- NameObjectCollectionBase.cs
- Parser.cs
- SqlExpressionNullability.cs
- SRDisplayNameAttribute.cs
- TextControlDesigner.cs
- ValidatingPropertiesEventArgs.cs
- Deflater.cs
- ProcessThreadDesigner.cs
- Style.cs
- CaseInsensitiveComparer.cs
- MsmqIntegrationSecurity.cs
- KeyEventArgs.cs
- _BaseOverlappedAsyncResult.cs
- TemplateKey.cs
- PerformanceCounterLib.cs
- assertwrapper.cs
- XmlNodeList.cs
- CapabilitiesSection.cs
- JournalNavigationScope.cs
- SecureEnvironment.cs
- NumericUpDown.cs
- TablePatternIdentifiers.cs
- ProviderCommandInfoUtils.cs
- EntityKey.cs
- GeneratedCodeAttribute.cs
- GlyphInfoList.cs
- SynchronizationContext.cs
- ExceptQueryOperator.cs
- MILUtilities.cs
- StringConcat.cs
- AlignmentXValidation.cs
- Ticks.cs
- DbMetaDataFactory.cs
- RefType.cs
- ThemeDirectoryCompiler.cs
- NamespaceInfo.cs
- SchemeSettingElementCollection.cs
- TreeNodeSelectionProcessor.cs
- DictionarySurrogate.cs
- RootProfilePropertySettingsCollection.cs
- HashCryptoHandle.cs
- CodeAttachEventStatement.cs
- PersistChildrenAttribute.cs
- UnmanagedMarshal.cs
- _LocalDataStoreMgr.cs
- XmlDictionaryWriter.cs
- KeyNotFoundException.cs
- VBIdentifierTrimConverter.cs
- ComplexPropertyEntry.cs
- storepermissionattribute.cs
- CrossContextChannel.cs
- WithStatement.cs
- PhysicalAddress.cs
- AppDomainProtocolHandler.cs
- BoolExpr.cs
- WizardStepBase.cs
- IDispatchConstantAttribute.cs