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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LassoHelper.cs
- SourceFileBuildProvider.cs
- RoleServiceManager.cs
- DataViewManager.cs
- ValidationRule.cs
- ContentDisposition.cs
- SerializationHelper.cs
- CollectionEditorDialog.cs
- DecoderFallbackWithFailureFlag.cs
- ShellProvider.cs
- StopStoryboard.cs
- DataRowView.cs
- SerializationSectionGroup.cs
- Pair.cs
- Baml2006ReaderSettings.cs
- RSAPKCS1KeyExchangeFormatter.cs
- TerminatingOperationBehavior.cs
- TextBoxLine.cs
- TimeSpanConverter.cs
- PackageRelationship.cs
- FlowDocument.cs
- DurableEnlistmentState.cs
- Rotation3DAnimationBase.cs
- FixUp.cs
- BoundColumn.cs
- ColorConverter.cs
- ProcessHostMapPath.cs
- SlipBehavior.cs
- MembershipSection.cs
- SqlGatherConsumedAliases.cs
- EmbeddedMailObject.cs
- CommandSet.cs
- WebCategoryAttribute.cs
- TypeResolvingOptionsAttribute.cs
- ChannelServices.cs
- GridViewSortEventArgs.cs
- ActivationServices.cs
- ReadOnlyAttribute.cs
- DataTableMappingCollection.cs
- CompositeFontFamily.cs
- LocatorBase.cs
- PublisherIdentityPermission.cs
- HuffmanTree.cs
- StylusButtonEventArgs.cs
- ScrollBarRenderer.cs
- EmptyImpersonationContext.cs
- RectangleHotSpot.cs
- HtmlInputSubmit.cs
- PointLightBase.cs
- FrameSecurityDescriptor.cs
- DotAtomReader.cs
- UnhandledExceptionEventArgs.cs
- PtsCache.cs
- ProfileSettings.cs
- SignerInfo.cs
- AnnotationComponentManager.cs
- ConfigViewGenerator.cs
- Variable.cs
- LayoutTableCell.cs
- TextBox.cs
- NativeMethods.cs
- UrlPropertyAttribute.cs
- DragEvent.cs
- ClientSideQueueItem.cs
- Opcode.cs
- DataSourceCache.cs
- DataTableTypeConverter.cs
- LookupBindingPropertiesAttribute.cs
- CounterCreationDataCollection.cs
- ExpressionPrefixAttribute.cs
- ValueExpressions.cs
- CodeDirectiveCollection.cs
- DeviceContexts.cs
- XamlFigureLengthSerializer.cs
- ContractNamespaceAttribute.cs
- Attributes.cs
- BaseDataList.cs
- AssociationTypeEmitter.cs
- SafeHandles.cs
- shaperfactory.cs
- CommandHelper.cs
- GridViewRowCollection.cs
- DrawingVisualDrawingContext.cs
- TextRange.cs
- FileReservationCollection.cs
- EventWaitHandle.cs
- WindowsAuthenticationModule.cs
- XamlSerializerUtil.cs
- formatstringdialog.cs
- ConnectionStringSettingsCollection.cs
- IsolatedStorageSecurityState.cs
- ReflectEventDescriptor.cs
- util.cs
- EnumerableRowCollectionExtensions.cs
- DetailsViewModeEventArgs.cs
- XamlToRtfWriter.cs
- StructuredProperty.cs
- EntityDataSourceValidationException.cs
- WebPartChrome.cs
- TimelineCollection.cs