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
- SerializationObjectManager.cs
- PropertyGroupDescription.cs
- Speller.cs
- SimpleBitVector32.cs
- TempFiles.cs
- SmiGettersStream.cs
- ValidatorCollection.cs
- HttpApplicationFactory.cs
- BitVec.cs
- XsltQilFactory.cs
- DrawingAttributes.cs
- KeySpline.cs
- MultipleFilterMatchesException.cs
- CollectionView.cs
- relpropertyhelper.cs
- AlphaSortedEnumConverter.cs
- TimeSpan.cs
- CustomWebEventKey.cs
- MetadataItemEmitter.cs
- RTLAwareMessageBox.cs
- GeneralTransform3DGroup.cs
- BufferModeSettings.cs
- RoutedUICommand.cs
- NameHandler.cs
- StreamAsIStream.cs
- RegistryKey.cs
- TransformerInfo.cs
- PixelShader.cs
- loginstatus.cs
- Gdiplus.cs
- SyncOperationState.cs
- _TransmitFileOverlappedAsyncResult.cs
- SchemaObjectWriter.cs
- PropertyMappingExceptionEventArgs.cs
- DrawingContext.cs
- DeclarativeConditionsCollection.cs
- PreviewPageInfo.cs
- ParagraphVisual.cs
- CodeSnippetStatement.cs
- KeyGesture.cs
- StringExpressionSet.cs
- NavigationProgressEventArgs.cs
- ServicePoint.cs
- AvTrace.cs
- DiscardableAttribute.cs
- TextUtf8RawTextWriter.cs
- TraceProvider.cs
- DrawingGroup.cs
- CallContext.cs
- Vector3DConverter.cs
- AppModelKnownContentFactory.cs
- ReadOnlyCollectionBase.cs
- ActivityDesignerResources.cs
- IsolationInterop.cs
- DataGridViewButtonColumn.cs
- EdmItemCollection.cs
- SimpleColumnProvider.cs
- PLINQETWProvider.cs
- DocComment.cs
- ScrollChrome.cs
- RemoveStoryboard.cs
- OdbcConnectionFactory.cs
- ParseChildrenAsPropertiesAttribute.cs
- ZoneIdentityPermission.cs
- DeviceContext2.cs
- XmlTypeAttribute.cs
- KnownTypes.cs
- TrimSurroundingWhitespaceAttribute.cs
- Positioning.cs
- IncrementalHitTester.cs
- DefaultWorkflowSchedulerService.cs
- MappingMetadataHelper.cs
- AttachedPropertyDescriptor.cs
- ExpressionBindings.cs
- SoapException.cs
- KeyEvent.cs
- PeerTransportElement.cs
- PageThemeBuildProvider.cs
- ServiceCredentials.cs
- TableSectionStyle.cs
- namescope.cs
- SchemaDeclBase.cs
- AppDomain.cs
- SqlCachedBuffer.cs
- DefaultValidator.cs
- Duration.cs
- X509UI.cs
- ClusterSafeNativeMethods.cs
- MailDefinition.cs
- HttpTransportSecurity.cs
- ImageSourceValueSerializer.cs
- XmlLinkedNode.cs
- BufferedGraphicsManager.cs
- sitestring.cs
- EntityType.cs
- WebBrowserDocumentCompletedEventHandler.cs
- EntitySetBaseCollection.cs
- JsonQNameDataContract.cs
- EventArgs.cs
- XmlDataSourceDesigner.cs