Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Collections / CaseInsensitiveComparer.cs / 1 / CaseInsensitiveComparer.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: CaseInsensitiveComparer ** ** ** ============================================================*/ namespace System.Collections { //This class does not contain members and does not need to be serializable using System; using System.Collections; using System.Globalization; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public class CaseInsensitiveComparer : IComparer { private CompareInfo m_compareInfo; private static CaseInsensitiveComparer m_InvariantCaseInsensitiveComparer; public CaseInsensitiveComparer() { m_compareInfo = CultureInfo.CurrentCulture.CompareInfo; } public CaseInsensitiveComparer(CultureInfo culture) { if (culture==null) { throw new ArgumentNullException("culture"); } m_compareInfo = culture.CompareInfo; } public static CaseInsensitiveComparer Default { get { return new CaseInsensitiveComparer(CultureInfo.CurrentCulture); } } public static CaseInsensitiveComparer DefaultInvariant { get { if (m_InvariantCaseInsensitiveComparer == null) { m_InvariantCaseInsensitiveComparer = new CaseInsensitiveComparer(CultureInfo.InvariantCulture); } return m_InvariantCaseInsensitiveComparer; } } // Behaves exactly like Comparer.Default.Compare except that the comparison is case insensitive // Compares two Objects by calling CompareTo. If a == // b,0 is returned. If a implements // IComparable, a.CompareTo(b) is returned. If a // doesn't implement IComparable and b does, // -(b.CompareTo(a)) is returned, otherwise an // exception is thrown. // public int Compare(Object a, Object b) { String sa = a as String; String sb = b as String; if (sa != null && sb != null) return m_compareInfo.Compare(sa, sb, CompareOptions.IgnoreCase); else return Comparer.Default.Compare(a,b); } } } // 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
- DbDataRecord.cs
- AuthenticationServiceManager.cs
- SmiRequestExecutor.cs
- PropertyDescriptorGridEntry.cs
- Panel.cs
- LogEntrySerializer.cs
- SRGSCompiler.cs
- PersonalizationProviderCollection.cs
- SchemaImporterExtensionElement.cs
- PeerNearMe.cs
- oledbmetadatacollectionnames.cs
- ProxyWebPartManager.cs
- keycontainerpermission.cs
- XmlDictionaryReaderQuotasElement.cs
- ComboBoxRenderer.cs
- TypeToken.cs
- HtmlImageAdapter.cs
- AuthenticationSection.cs
- LinkAreaEditor.cs
- MediaElementAutomationPeer.cs
- DesignerVerbCollection.cs
- FontStretches.cs
- Connector.cs
- CqlParserHelpers.cs
- PipelineModuleStepContainer.cs
- ItemDragEvent.cs
- SQLStringStorage.cs
- DataGridColumnEventArgs.cs
- ModelService.cs
- XPathNodePointer.cs
- QilTargetType.cs
- AsyncOperation.cs
- XsdBuildProvider.cs
- OleDbInfoMessageEvent.cs
- URI.cs
- TaskSchedulerException.cs
- OleDbStruct.cs
- ShapingEngine.cs
- querybuilder.cs
- AnnotationObservableCollection.cs
- DropShadowBitmapEffect.cs
- ContentPresenter.cs
- SequenceFullException.cs
- DetailsViewDeletedEventArgs.cs
- ContainerActivationHelper.cs
- Source.cs
- TextProperties.cs
- EnumMember.cs
- EnumerableCollectionView.cs
- XmlSchemaSequence.cs
- HitTestFilterBehavior.cs
- MailMessageEventArgs.cs
- DesignerAdapterAttribute.cs
- ListChangedEventArgs.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- SrgsElementList.cs
- Vector3DCollectionValueSerializer.cs
- RegularExpressionValidator.cs
- MULTI_QI.cs
- _ConnectStream.cs
- LambdaCompiler.Address.cs
- ContractMapping.cs
- COM2Properties.cs
- DiffuseMaterial.cs
- ChangesetResponse.cs
- WebPartHeaderCloseVerb.cs
- StackSpiller.Temps.cs
- XmlSubtreeReader.cs
- ComplusTypeValidator.cs
- TextStore.cs
- XmlEncodedRawTextWriter.cs
- WorkflowInstanceExtensionProvider.cs
- X509Chain.cs
- Root.cs
- ConnectionAcceptor.cs
- EdmSchemaAttribute.cs
- CurrencyManager.cs
- SizeChangedInfo.cs
- WindowsFont.cs
- CompletionCallbackWrapper.cs
- XmlSchemaComplexContentRestriction.cs
- DiscreteKeyFrames.cs
- ConnectionProviderAttribute.cs
- ControlBindingsCollection.cs
- _DomainName.cs
- DataObjectMethodAttribute.cs
- AuthenticationException.cs
- TemplateControl.cs
- mongolianshape.cs
- SignatureResourcePool.cs
- DummyDataSource.cs
- SwitchAttribute.cs
- RepeaterItemCollection.cs
- ProfileGroupSettingsCollection.cs
- JsonWriter.cs
- WebEventCodes.cs
- FixedSOMImage.cs
- AppDomain.cs
- DoubleCollectionConverter.cs
- AutomationIdentifierGuids.cs