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
- SQLInt32.cs
- Substitution.cs
- IPCCacheManager.cs
- wmiutil.cs
- FixedTextContainer.cs
- FunctionDescription.cs
- Process.cs
- SafeCoTaskMem.cs
- StringWriter.cs
- MaskDescriptor.cs
- Rule.cs
- XmlSchemaInclude.cs
- activationcontext.cs
- CatchDesigner.xaml.cs
- UnicastIPAddressInformationCollection.cs
- BmpBitmapDecoder.cs
- cache.cs
- QuestionEventArgs.cs
- NativeMethods.cs
- XsltArgumentList.cs
- Compilation.cs
- SchemaTypeEmitter.cs
- MetaTableHelper.cs
- FontDialog.cs
- SynchronizedInputPattern.cs
- BrushValueSerializer.cs
- StatusBarAutomationPeer.cs
- ArcSegment.cs
- ScriptResourceDefinition.cs
- ExpressionBinding.cs
- NullReferenceException.cs
- DrawingAttributes.cs
- MetabaseReader.cs
- TransformerConfigurationWizardBase.cs
- RangeValidator.cs
- ConfigPathUtility.cs
- ProcessModelSection.cs
- RuntimeHandles.cs
- PriorityBinding.cs
- SourceFileBuildProvider.cs
- SamlSerializer.cs
- TypeLoadException.cs
- ApplicationServicesHostFactory.cs
- AnimationStorage.cs
- HtmlShimManager.cs
- EnumValidator.cs
- DocumentPageHost.cs
- XmlEnumAttribute.cs
- DictionaryChange.cs
- ModelTreeManager.cs
- Marshal.cs
- DnsPermission.cs
- EncoderParameter.cs
- AbsoluteQuery.cs
- DockingAttribute.cs
- ProxyManager.cs
- PeerApplication.cs
- XamlPoint3DCollectionSerializer.cs
- ButtonChrome.cs
- HtmlLiteralTextAdapter.cs
- NavigationExpr.cs
- ParallelEnumerable.cs
- QilNode.cs
- PeerResolverBindingElement.cs
- NavigationHelper.cs
- DeviceContexts.cs
- Wildcard.cs
- DataGridViewCellStateChangedEventArgs.cs
- DependencyObjectType.cs
- Avt.cs
- ViewService.cs
- ButtonPopupAdapter.cs
- HMACSHA384.cs
- ContextMenu.cs
- Parser.cs
- ExpandButtonVisibilityConverter.cs
- TreeView.cs
- ContextMenu.cs
- ScaleTransform3D.cs
- StrokeNodeEnumerator.cs
- IdnElement.cs
- JapaneseLunisolarCalendar.cs
- XmlAttributes.cs
- HtmlValidatorAdapter.cs
- Vector.cs
- DataError.cs
- Item.cs
- SqlDataSourceQueryEditor.cs
- RawStylusSystemGestureInputReport.cs
- TraceHwndHost.cs
- ToolStripDropTargetManager.cs
- ScriptResourceAttribute.cs
- XmlStreamNodeWriter.cs
- Rotation3DAnimation.cs
- ObservableDictionary.cs
- WebConfigurationHostFileChange.cs
- BuilderElements.cs
- InvalidateEvent.cs
- SqlWebEventProvider.cs
- UserPrincipalNameElement.cs