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
- CodeTryCatchFinallyStatement.cs
- NativeMethods.cs
- WindowsSysHeader.cs
- RepeatButton.cs
- Light.cs
- TemplateEditingService.cs
- NonVisualControlAttribute.cs
- MenuCommands.cs
- ListViewItemSelectionChangedEvent.cs
- _SpnDictionary.cs
- EndpointIdentityExtension.cs
- CodeSpit.cs
- NegatedCellConstant.cs
- GeometryModel3D.cs
- XmlNodeChangedEventManager.cs
- XPathBuilder.cs
- CompositeCollectionView.cs
- NumericUpDown.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- Transform3DGroup.cs
- InstanceNameConverter.cs
- AudioSignalProblemOccurredEventArgs.cs
- SqlDataSourceQueryEditor.cs
- ServiceX509SecurityTokenProvider.cs
- VerificationException.cs
- CornerRadius.cs
- FixedTextPointer.cs
- UICuesEvent.cs
- GridViewColumnHeader.cs
- MailDefinition.cs
- BaseValidator.cs
- XmlException.cs
- SystemNetworkInterface.cs
- FrameworkElementAutomationPeer.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- SqlNotificationEventArgs.cs
- RequestSecurityTokenResponseCollection.cs
- SchemaElement.cs
- WebPartHelpVerb.cs
- DoubleAnimationBase.cs
- ResourcePart.cs
- SubstitutionDesigner.cs
- StorageMappingFragment.cs
- RadioButtonStandardAdapter.cs
- AlgoModule.cs
- XmlElementCollection.cs
- TabOrder.cs
- BookmarkTable.cs
- SymmetricCryptoHandle.cs
- XmlElementList.cs
- MimeTextImporter.cs
- CodeTypeReferenceExpression.cs
- TemplateKey.cs
- WindowPattern.cs
- DataGridComponentEditor.cs
- SupportedAddressingMode.cs
- DependentList.cs
- AnimationClock.cs
- FunctionQuery.cs
- XhtmlBasicTextViewAdapter.cs
- TextSelection.cs
- AuthenticationService.cs
- SafeNativeMethods.cs
- DataGridViewSelectedRowCollection.cs
- Helpers.cs
- CapacityStreamGeometryContext.cs
- CheckBoxRenderer.cs
- CompletionBookmark.cs
- MatchingStyle.cs
- SQLDouble.cs
- ConnectionManagementElement.cs
- HandleExceptionArgs.cs
- ChannelServices.cs
- CqlQuery.cs
- WebPartMenu.cs
- SqlLiftWhereClauses.cs
- MachineSettingsSection.cs
- DoubleCollection.cs
- KeyFrames.cs
- BinaryNode.cs
- AsyncOperationManager.cs
- MailSettingsSection.cs
- FeatureSupport.cs
- WebPartExportVerb.cs
- XmlNamespaceManager.cs
- RuntimeHelpers.cs
- ColorConvertedBitmap.cs
- DrawingBrush.cs
- LicenseException.cs
- Point3D.cs
- StringConverter.cs
- PrtCap_Base.cs
- DuplexChannelFactory.cs
- PublishLicense.cs
- XmlArrayItemAttribute.cs
- CatalogZoneBase.cs
- AnnotationComponentChooser.cs
- StreamGeometry.cs
- DataGridViewElement.cs
- BigInt.cs