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
- SettingsPropertyCollection.cs
- WsatServiceCertificate.cs
- AttachInfo.cs
- OciLobLocator.cs
- ConversionValidationRule.cs
- precedingquery.cs
- XmlSortKey.cs
- DbConnectionPoolGroupProviderInfo.cs
- InheritedPropertyChangedEventArgs.cs
- TextAutomationPeer.cs
- TextBox.cs
- DecimalStorage.cs
- TypeUsageBuilder.cs
- ProtocolsConfigurationEntry.cs
- XPathEmptyIterator.cs
- KnowledgeBase.cs
- EntityTypeEmitter.cs
- View.cs
- ModelFunctionTypeElement.cs
- HostingEnvironmentSection.cs
- AmbientValueAttribute.cs
- SymmetricCryptoHandle.cs
- DataGrid.cs
- LinqDataSourceContextEventArgs.cs
- HwndSourceKeyboardInputSite.cs
- DesignerSerializationManager.cs
- WindowShowOrOpenTracker.cs
- ActivationServices.cs
- CompilerParameters.cs
- NonVisualControlAttribute.cs
- Light.cs
- WorkflowEnvironment.cs
- UIElementParagraph.cs
- ZoomingMessageFilter.cs
- MemoryFailPoint.cs
- EventProvider.cs
- ActivationServices.cs
- NativeRightsManagementAPIsStructures.cs
- SchemeSettingElementCollection.cs
- CodeAttributeDeclarationCollection.cs
- AssemblyName.cs
- DataGridRowHeader.cs
- TraceHandlerErrorFormatter.cs
- CapabilitiesSection.cs
- ChannelServices.cs
- unsafenativemethodstextservices.cs
- StaticResourceExtension.cs
- OleDbConnectionFactory.cs
- ValidatedMobileControlConverter.cs
- Rules.cs
- Mutex.cs
- SchemaCollectionPreprocessor.cs
- LinqTreeNodeEvaluator.cs
- ApplicationServiceHelper.cs
- OleDbTransaction.cs
- OptimizedTemplateContent.cs
- SqlVisitor.cs
- CqlParserHelpers.cs
- ArithmeticException.cs
- Odbc32.cs
- DrawingDrawingContext.cs
- Baml2006ReaderFrame.cs
- MenuItem.cs
- TailCallAnalyzer.cs
- PtsContext.cs
- RijndaelManaged.cs
- HopperCache.cs
- ConnectionProviderAttribute.cs
- CngProvider.cs
- Buffer.cs
- Soap.cs
- RoleGroup.cs
- StringAnimationUsingKeyFrames.cs
- InternalEnumValidatorAttribute.cs
- ResourceAssociationType.cs
- ITreeGenerator.cs
- MessageBuilder.cs
- WebServiceData.cs
- Binding.cs
- ThreadInterruptedException.cs
- ContextQuery.cs
- SystemIPv4InterfaceProperties.cs
- DataObjectCopyingEventArgs.cs
- NullableConverter.cs
- Cursor.cs
- HtmlEmptyTagControlBuilder.cs
- ByteAnimation.cs
- UrlPropertyAttribute.cs
- DesignTimeData.cs
- PlainXmlSerializer.cs
- RecommendedAsConfigurableAttribute.cs
- PolicyStatement.cs
- DesignerSerializationManager.cs
- SqlReorderer.cs
- VideoDrawing.cs
- ItemContainerPattern.cs
- Enlistment.cs
- SendingRequestEventArgs.cs
- ToolTipService.cs
- DefaultValueTypeConverter.cs