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
- HttpBindingExtension.cs
- BamlResourceContent.cs
- WindowsIdentity.cs
- GregorianCalendarHelper.cs
- HttpWebRequest.cs
- Vector3DKeyFrameCollection.cs
- LoginUtil.cs
- Thread.cs
- ParameterCollection.cs
- _DisconnectOverlappedAsyncResult.cs
- Byte.cs
- DesignerTextWriter.cs
- FirstMatchCodeGroup.cs
- TagMapInfo.cs
- ByteStorage.cs
- ReadOnlyPermissionSet.cs
- UITypeEditors.cs
- GridItemPattern.cs
- SessionStateItemCollection.cs
- PreviewKeyDownEventArgs.cs
- IPAddressCollection.cs
- DictionarySectionHandler.cs
- HwndSource.cs
- GridViewColumnHeaderAutomationPeer.cs
- bindurihelper.cs
- TextTreeInsertUndoUnit.cs
- NullableLongMinMaxAggregationOperator.cs
- DCSafeHandle.cs
- JsonDeserializer.cs
- SafeBuffer.cs
- SQLMoney.cs
- SafeProcessHandle.cs
- XamlPathDataSerializer.cs
- HierarchicalDataBoundControlAdapter.cs
- PrimitiveSchema.cs
- ItemChangedEventArgs.cs
- Drawing.cs
- WindowsEditBoxRange.cs
- ListManagerBindingsCollection.cs
- GPPOINT.cs
- ErrorTableItemStyle.cs
- XmlCompatibilityReader.cs
- ComponentEditorForm.cs
- ClassData.cs
- AbsoluteQuery.cs
- CodeDOMUtility.cs
- XPathNavigatorKeyComparer.cs
- DbProviderManifest.cs
- UserNameSecurityTokenProvider.cs
- DurableInstanceContextProvider.cs
- CqlQuery.cs
- TimerExtension.cs
- WindowsRebar.cs
- BrowserCapabilitiesCodeGenerator.cs
- PeerCollaboration.cs
- Int32RectValueSerializer.cs
- CopyCodeAction.cs
- EdmProviderManifest.cs
- GetLedgerEntryForRecipientRequest.cs
- RuleConditionDialog.Designer.cs
- ReferenceTypeElement.cs
- OpenTypeLayoutCache.cs
- ConfigXmlCDataSection.cs
- DrawListViewItemEventArgs.cs
- CheckBoxList.cs
- InspectionWorker.cs
- autovalidator.cs
- XPathAncestorQuery.cs
- DataGridViewCellStyle.cs
- GeometryCollection.cs
- StringConverter.cs
- _AcceptOverlappedAsyncResult.cs
- DataBoundLiteralControl.cs
- DataSet.cs
- XmlSchemaParticle.cs
- SizeValueSerializer.cs
- counter.cs
- XpsS0ValidatingLoader.cs
- DynamicActivityTypeDescriptor.cs
- TransformGroup.cs
- DataGridPagerStyle.cs
- EntitySetBaseCollection.cs
- RuntimeIdentifierPropertyAttribute.cs
- unsafenativemethodstextservices.cs
- ComplexPropertyEntry.cs
- RowToFieldTransformer.cs
- InputLangChangeEvent.cs
- AtomServiceDocumentSerializer.cs
- TwoPhaseCommit.cs
- GridView.cs
- WindowsListBox.cs
- DataBinder.cs
- RequiredFieldValidator.cs
- Closure.cs
- ImportCatalogPart.cs
- OlePropertyStructs.cs
- ScrollChrome.cs
- FixedTextBuilder.cs
- TypeReference.cs
- PrimitiveXmlSerializers.cs