Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- UInt16Storage.cs
- SafeArrayRankMismatchException.cs
- CookieParameter.cs
- SemanticResultValue.cs
- TrustManagerPromptUI.cs
- WebServiceEndpoint.cs
- PathTooLongException.cs
- DefaultObjectMappingItemCollection.cs
- DropTarget.cs
- RoleManagerEventArgs.cs
- HttpCookie.cs
- FormatException.cs
- AppliedDeviceFiltersEditor.cs
- HtmlForm.cs
- ConfigsHelper.cs
- ReferencedAssemblyResolver.cs
- XmlSchemaDocumentation.cs
- XhtmlTextWriter.cs
- SymbolTable.cs
- BamlVersionHeader.cs
- HwndKeyboardInputProvider.cs
- EdmType.cs
- Operator.cs
- InfoCardCryptoHelper.cs
- RoutedUICommand.cs
- AndCondition.cs
- AsmxEndpointPickerExtension.cs
- BCLDebug.cs
- BitmapEffectRenderDataResource.cs
- UpdatePanelTrigger.cs
- HttpConfigurationSystem.cs
- COAUTHINFO.cs
- KeyboardNavigation.cs
- SqlProfileProvider.cs
- FlowDocumentReaderAutomationPeer.cs
- FontFamilyConverter.cs
- LeftCellWrapper.cs
- ClientUrlResolverWrapper.cs
- ThreadNeutralSemaphore.cs
- remotingproxy.cs
- DerivedKeySecurityToken.cs
- Helpers.cs
- MenuBindingsEditor.cs
- StringToken.cs
- CheckBoxDesigner.cs
- IconConverter.cs
- CatalogZoneBase.cs
- SpellCheck.cs
- BindingCollectionElement.cs
- OdbcErrorCollection.cs
- WindowsListViewGroup.cs
- Resources.Designer.cs
- SecurityTokenException.cs
- IPGlobalProperties.cs
- WebControlAdapter.cs
- ListenerElementsCollection.cs
- ObjectSelectorEditor.cs
- IdentitySection.cs
- TextBoxBase.cs
- SafeHGlobalHandleCritical.cs
- TraceContext.cs
- ItemsChangedEventArgs.cs
- DateTime.cs
- AppModelKnownContentFactory.cs
- RegexNode.cs
- RelationalExpressions.cs
- ErasingStroke.cs
- SmtpNetworkElement.cs
- ReflectEventDescriptor.cs
- InternalBase.cs
- DataColumnPropertyDescriptor.cs
- FilterEventArgs.cs
- ForwardPositionQuery.cs
- Authorization.cs
- TaskHelper.cs
- DependentTransaction.cs
- ACE.cs
- XmlUrlResolver.cs
- XmlSchemaObjectCollection.cs
- ProfilePropertySettings.cs
- SetStateDesigner.cs
- TraversalRequest.cs
- WebPartPersonalization.cs
- ConnectionProviderAttribute.cs
- DataGridViewToolTip.cs
- ImportOptions.cs
- TextureBrush.cs
- Logging.cs
- TextOptions.cs
- SortedList.cs
- ColorMatrix.cs
- ReverseInheritProperty.cs
- DateTimeValueSerializerContext.cs
- DrawListViewColumnHeaderEventArgs.cs
- FontUnitConverter.cs
- AnnotationAdorner.cs
- ValueTable.cs
- PermissionSet.cs
- TableLayoutColumnStyleCollection.cs
- FormViewInsertEventArgs.cs