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

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SecUtil.cs
- GeometryConverter.cs
- RepeatInfo.cs
- MetadataItemEmitter.cs
- SingleTagSectionHandler.cs
- CodeAttributeDeclaration.cs
- WebServiceTypeData.cs
- ConfigurationManagerInternalFactory.cs
- SerializableAttribute.cs
- WebRequestModulesSection.cs
- CodeCatchClause.cs
- Select.cs
- DayRenderEvent.cs
- SingleAnimationUsingKeyFrames.cs
- FormViewModeEventArgs.cs
- HandleCollector.cs
- SafePipeHandle.cs
- ChoiceConverter.cs
- WorkflowCompensationBehavior.cs
- FlowDocumentPage.cs
- ObjectManager.cs
- TaskFileService.cs
- ObjectHandle.cs
- EntityParameterCollection.cs
- XPathAncestorQuery.cs
- PropertyDescriptor.cs
- AvtEvent.cs
- OverrideMode.cs
- StateChangeEvent.cs
- ProcessHostConfigUtils.cs
- WaitHandle.cs
- LogRecordSequence.cs
- WindowsEditBoxRange.cs
- PolyBezierSegment.cs
- SimpleType.cs
- TransformerInfo.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- DataControlFieldCell.cs
- Point4DValueSerializer.cs
- AsyncInvokeContext.cs
- InternalControlCollection.cs
- ExpanderAutomationPeer.cs
- AlgoModule.cs
- Pool.cs
- UIElement.cs
- ReadOnlyCollectionBuilder.cs
- DataGridRow.cs
- FixedSOMTableRow.cs
- Literal.cs
- CompilerGeneratedAttribute.cs
- WSFederationHttpBindingElement.cs
- ManualResetEvent.cs
- HwndSubclass.cs
- PkcsUtils.cs
- SqlBooleanMismatchVisitor.cs
- AdRotator.cs
- DesignerObject.cs
- KeySplineConverter.cs
- LingerOption.cs
- HelpEvent.cs
- SqlResolver.cs
- RuntimeVariableList.cs
- WebPartHeaderCloseVerb.cs
- Help.cs
- TransformGroup.cs
- BStrWrapper.cs
- OledbConnectionStringbuilder.cs
- XXXInfos.cs
- HttpCacheParams.cs
- RPIdentityRequirement.cs
- SplashScreenNativeMethods.cs
- IProvider.cs
- PriorityQueue.cs
- RsaSecurityToken.cs
- GenericIdentity.cs
- TextDecorationLocationValidation.cs
- ResourceProperty.cs
- MatrixAnimationBase.cs
- MimeMapping.cs
- IsolatedStorage.cs
- PageParserFilter.cs
- RemotingConfiguration.cs
- ExpandedProjectionNode.cs
- SerialErrors.cs
- IPPacketInformation.cs
- COM2ExtendedUITypeEditor.cs
- EdmRelationshipRoleAttribute.cs
- StdValidatorsAndConverters.cs
- DnsPermission.cs
- TabControl.cs
- StreamedWorkflowDefinitionContext.cs
- XmlComment.cs
- ClockGroup.cs
- rsa.cs
- InvalidFilterCriteriaException.cs
- DesignerCategoryAttribute.cs
- SamlAssertionDirectKeyIdentifierClause.cs
- ListViewItem.cs
- MetabaseReader.cs
- DataReaderContainer.cs