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
- CurrentChangedEventManager.cs
- PostBackTrigger.cs
- ToolStripDesignerAvailabilityAttribute.cs
- TextBlockAutomationPeer.cs
- ChangeConflicts.cs
- BasicCellRelation.cs
- DBNull.cs
- Propagator.Evaluator.cs
- WebConfigManager.cs
- OdbcEnvironmentHandle.cs
- Camera.cs
- TransactionFlowOption.cs
- SharedPerformanceCounter.cs
- XmlAtomicValue.cs
- TableCell.cs
- ConversionContext.cs
- CallbackValidatorAttribute.cs
- HandledMouseEvent.cs
- SctClaimDictionary.cs
- SqlStream.cs
- SqlServer2KCompatibilityCheck.cs
- QilXmlWriter.cs
- TransformPatternIdentifiers.cs
- CodeTypeParameter.cs
- ClientSponsor.cs
- _Rfc2616CacheValidators.cs
- HandledMouseEvent.cs
- GCHandleCookieTable.cs
- OleDbSchemaGuid.cs
- WindowsFormsHost.cs
- XsltSettings.cs
- SliderAutomationPeer.cs
- SourceElementsCollection.cs
- BaseResourcesBuildProvider.cs
- QilLoop.cs
- StylusLogic.cs
- CircleHotSpot.cs
- ProviderManager.cs
- SafeArrayRankMismatchException.cs
- PngBitmapDecoder.cs
- SqlCachedBuffer.cs
- EntityDataSourceWrapperCollection.cs
- CultureInfo.cs
- EdmValidator.cs
- NetStream.cs
- ClientTargetSection.cs
- SerializationAttributes.cs
- WriteableBitmap.cs
- BindingCompleteEventArgs.cs
- Path.cs
- IgnoreFlushAndCloseStream.cs
- ReleaseInstanceMode.cs
- TableLayoutPanelCellPosition.cs
- TypeConstant.cs
- XmlValueConverter.cs
- AttributeAction.cs
- DataService.cs
- XmlObjectSerializerWriteContextComplex.cs
- QilList.cs
- securitycriticaldataClass.cs
- UnaryExpression.cs
- TaskCanceledException.cs
- PropertyCondition.cs
- LinkedResource.cs
- HandlerFactoryWrapper.cs
- HttpApplication.cs
- SQLBytesStorage.cs
- CqlWriter.cs
- SessionStateItemCollection.cs
- MetadataExchangeClient.cs
- CodeGen.cs
- FtpCachePolicyElement.cs
- UInt32.cs
- ColumnPropertiesGroup.cs
- StreamMarshaler.cs
- ValueExpressions.cs
- StateFinalizationDesigner.cs
- UnaryNode.cs
- PropertyCollection.cs
- ApplicationCommands.cs
- Vector3DConverter.cs
- SmiRequestExecutor.cs
- BaseEntityWrapper.cs
- Debug.cs
- TaskHelper.cs
- HyperLinkDesigner.cs
- ToolboxDataAttribute.cs
- FileDialog.cs
- StorageFunctionMapping.cs
- LockRecursionException.cs
- PartitionResolver.cs
- CodeCastExpression.cs
- XmlAutoDetectWriter.cs
- WindowsToolbar.cs
- MetadataItemSerializer.cs
- ZipIOCentralDirectoryFileHeader.cs
- Helpers.cs
- EndEvent.cs
- BitStack.cs
- StylusTouchDevice.cs