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
- FlagsAttribute.cs
- SafeThemeHandle.cs
- SerializationHelper.cs
- LinqDataSourceStatusEventArgs.cs
- ImageClickEventArgs.cs
- EditorPartChrome.cs
- DispatcherHooks.cs
- ItemAutomationPeer.cs
- HtmlShimManager.cs
- HtmlTernaryTree.cs
- SatelliteContractVersionAttribute.cs
- dataSvcMapFileLoader.cs
- HostProtectionPermission.cs
- SqlInternalConnectionTds.cs
- SequentialWorkflowRootDesigner.cs
- CellLabel.cs
- DragDrop.cs
- ElapsedEventArgs.cs
- ServiceSettingsResponseInfo.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ActivityDelegate.cs
- SendMailErrorEventArgs.cs
- _FixedSizeReader.cs
- EmptyEnumerable.cs
- IndentTextWriter.cs
- Hash.cs
- SizeAnimationUsingKeyFrames.cs
- ThicknessKeyFrameCollection.cs
- TransformGroup.cs
- TdsParserSafeHandles.cs
- ExpressionList.cs
- FullTrustAssembly.cs
- DefaultObjectMappingItemCollection.cs
- MailFileEditor.cs
- ListViewTableCell.cs
- Globals.cs
- CaseKeyBox.xaml.cs
- ClientTarget.cs
- SqlFacetAttribute.cs
- PropertyTabChangedEvent.cs
- AuthenticationModulesSection.cs
- Point4D.cs
- SettingsPropertyWrongTypeException.cs
- FileChangesMonitor.cs
- CellConstant.cs
- XmlDocumentType.cs
- ExeConfigurationFileMap.cs
- SmiSettersStream.cs
- DefaultWorkflowLoaderService.cs
- ChannelPool.cs
- ExtendedPropertyDescriptor.cs
- AnimationClockResource.cs
- LinqDataSourceValidationException.cs
- OutputCacheSection.cs
- ClassImporter.cs
- DesignerAutoFormatStyle.cs
- RadioButtonPopupAdapter.cs
- DataSourceControlBuilder.cs
- figurelengthconverter.cs
- entityreference_tresulttype.cs
- RoleService.cs
- GeneralTransform2DTo3D.cs
- TextTreeInsertUndoUnit.cs
- Vector3D.cs
- AutomationElementIdentifiers.cs
- DesignerActionKeyboardBehavior.cs
- DataServiceClientException.cs
- MiniConstructorInfo.cs
- MetadataArtifactLoaderCompositeFile.cs
- InfoCardArgumentException.cs
- TreeNodeBindingDepthConverter.cs
- WebPartConnectionsCancelVerb.cs
- PeerToPeerException.cs
- ShapeTypeface.cs
- ObjectDataSourceMethodEventArgs.cs
- AsyncDataRequest.cs
- QilSortKey.cs
- DataServiceStreamProviderWrapper.cs
- TreeNodeMouseHoverEvent.cs
- PhysicalOps.cs
- SchemaMapping.cs
- CaseExpr.cs
- ChainOfDependencies.cs
- Bidi.cs
- ParsedRoute.cs
- DependencyPropertyValueSerializer.cs
- ArrayWithOffset.cs
- ExclusiveTcpListener.cs
- InvalidFilterCriteriaException.cs
- FlowDocumentFormatter.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- IncrementalHitTester.cs
- StorageComplexTypeMapping.cs
- DrawingAttributes.cs
- Action.cs
- ParameterBinding.cs
- ParallelTimeline.cs
- Point3D.cs
- WindowPattern.cs
- SQLChars.cs