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
- OdbcCommand.cs
- AppSecurityManager.cs
- ValidationPropertyAttribute.cs
- CodeTypeOfExpression.cs
- ApplicationServiceHelper.cs
- DocumentPageHost.cs
- RotateTransform.cs
- TargetParameterCountException.cs
- WebReferencesBuildProvider.cs
- ParsedRoute.cs
- Configuration.cs
- SubpageParagraph.cs
- MetadataStore.cs
- GridItemPatternIdentifiers.cs
- PropertyGridView.cs
- MarkupProperty.cs
- SerializationException.cs
- ApplicationInterop.cs
- GiveFeedbackEvent.cs
- DataBindingList.cs
- MethodToken.cs
- DescendentsWalkerBase.cs
- HScrollProperties.cs
- BamlStream.cs
- ItemCheckEvent.cs
- WebPartVerb.cs
- ParameterCollection.cs
- ProfileParameter.cs
- StsCommunicationException.cs
- XmlDictionary.cs
- ResourcesBuildProvider.cs
- unsafenativemethodsother.cs
- Clause.cs
- HandleTable.cs
- BaseCodeDomTreeGenerator.cs
- WbemProvider.cs
- Misc.cs
- UserMapPath.cs
- ViewLoader.cs
- XamlStream.cs
- TextEditorLists.cs
- ProfessionalColors.cs
- MimeBasePart.cs
- Queue.cs
- ImportContext.cs
- Literal.cs
- TextEditorParagraphs.cs
- ProfileGroupSettingsCollection.cs
- FormDesigner.cs
- HttpCapabilitiesBase.cs
- DnsPermission.cs
- RoleService.cs
- CheckBox.cs
- XmlSortKeyAccumulator.cs
- SQLBytes.cs
- GridViewItemAutomationPeer.cs
- WmfPlaceableFileHeader.cs
- CompilerGeneratedAttribute.cs
- XmlChildNodes.cs
- CellQuery.cs
- SqlNamer.cs
- InputLangChangeRequestEvent.cs
- BinHexEncoder.cs
- RuntimeHelpers.cs
- TargetConverter.cs
- ToolBar.cs
- PasswordDeriveBytes.cs
- CollectionViewProxy.cs
- QueuePropertyVariants.cs
- IntranetCredentialPolicy.cs
- DispatcherSynchronizationContext.cs
- ErrorFormatter.cs
- Transform.cs
- InstancePersistence.cs
- QueryStatement.cs
- ConnectionsZoneDesigner.cs
- MultipartIdentifier.cs
- VisemeEventArgs.cs
- FormatException.cs
- AsyncResult.cs
- Baml2006ReaderContext.cs
- SizeChangedEventArgs.cs
- SiteOfOriginPart.cs
- DiscoveryEndpointValidator.cs
- ChannelBinding.cs
- TextAdaptor.cs
- DataRowExtensions.cs
- DropShadowBitmapEffect.cs
- FindCriteria11.cs
- ConstrainedDataObject.cs
- String.cs
- ResourceSet.cs
- HwndSourceParameters.cs
- SqlSupersetValidator.cs
- NavigatorOutput.cs
- ConnectionStringsExpressionBuilder.cs
- FontWeight.cs
- System.Data_BID.cs
- MetadataHelper.cs
- DataGridViewLinkColumn.cs