Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // // ==--== /*============================================================ ** ** 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpressionList.cs
- QueryOperator.cs
- BaseServiceProvider.cs
- RevocationPoint.cs
- DataGridViewCellMouseEventArgs.cs
- InfiniteIntConverter.cs
- DesignerRegionCollection.cs
- StylusPlugInCollection.cs
- SrgsDocument.cs
- Size.cs
- RectAnimationBase.cs
- TrustManagerPromptUI.cs
- XdrBuilder.cs
- MailBnfHelper.cs
- WorkflowRuntimeBehavior.cs
- TypedReference.cs
- FontStyles.cs
- FreezableOperations.cs
- ToolStripContentPanel.cs
- LogicalTreeHelper.cs
- TextEndOfLine.cs
- ExceptionHelpers.cs
- AssemblyGen.cs
- InvariantComparer.cs
- HandlerFactoryCache.cs
- HttpInputStream.cs
- TableLayoutPanelResizeGlyph.cs
- DataMemberAttribute.cs
- TypeHelper.cs
- BitmapEffectGroup.cs
- ConfigurationSchemaErrors.cs
- MaterialGroup.cs
- ProjectionRewriter.cs
- StronglyTypedResourceBuilder.cs
- CodeMethodMap.cs
- VerticalAlignConverter.cs
- XmlArrayItemAttributes.cs
- RSAOAEPKeyExchangeFormatter.cs
- SocketElement.cs
- ManipulationVelocities.cs
- WasAdminWrapper.cs
- SystemIPInterfaceStatistics.cs
- BaseCodePageEncoding.cs
- DbInsertCommandTree.cs
- OdbcUtils.cs
- EntityDataSourceContainerNameConverter.cs
- ConvertEvent.cs
- ExtensionQuery.cs
- ThemeDirectoryCompiler.cs
- ContextProperty.cs
- NavigateEvent.cs
- HealthMonitoringSectionHelper.cs
- RequestResponse.cs
- Baml2006KnownTypes.cs
- CodeActivityContext.cs
- TakeQueryOptionExpression.cs
- KerberosSecurityTokenAuthenticator.cs
- OSEnvironmentHelper.cs
- CustomBindingElementCollection.cs
- HwndSourceKeyboardInputSite.cs
- ComponentResourceKeyConverter.cs
- SafeThemeHandle.cs
- GeometryDrawing.cs
- CustomWebEventKey.cs
- TemplatedMailWebEventProvider.cs
- NativeMethods.cs
- httpserverutility.cs
- UnionExpr.cs
- ChannelRequirements.cs
- InvokeMethod.cs
- AmbiguousMatchException.cs
- OracleParameter.cs
- TdsParserHelperClasses.cs
- ConstraintConverter.cs
- COM2ExtendedBrowsingHandler.cs
- DocumentPageViewAutomationPeer.cs
- ApplicationSecurityManager.cs
- RecordConverter.cs
- HttpPostedFileBase.cs
- altserialization.cs
- LinqDataSourceStatusEventArgs.cs
- IxmlLineInfo.cs
- Lasso.cs
- DataBoundControlDesigner.cs
- RuleSetDialog.Designer.cs
- Propagator.Evaluator.cs
- FileSecurity.cs
- OleDbCommandBuilder.cs
- ActivityInstanceMap.cs
- BaseCollection.cs
- DetailsViewDeleteEventArgs.cs
- ToolZone.cs
- Highlights.cs
- MutexSecurity.cs
- GroupBoxRenderer.cs
- DrawingAttributesDefaultValueFactory.cs
- ScriptingSectionGroup.cs
- ClientBuildManagerCallback.cs
- PathNode.cs
- CompositeTypefaceMetrics.cs