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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TableAdapterManagerGenerator.cs
- RequestCachePolicyConverter.cs
- listitem.cs
- CacheAxisQuery.cs
- SoapHelper.cs
- COM2PictureConverter.cs
- XPathDocumentNavigator.cs
- StretchValidation.cs
- Filter.cs
- FixedSOMGroup.cs
- IERequestCache.cs
- DesignerVerbCollection.cs
- PeerObject.cs
- ListViewTableCell.cs
- oledbmetadatacollectionnames.cs
- BrowserTree.cs
- UTF8Encoding.cs
- HelpKeywordAttribute.cs
- AutomationPropertyChangedEventArgs.cs
- ReadOnlyDataSourceView.cs
- TypeUtils.cs
- ConfigurationManagerHelper.cs
- EventManager.cs
- ToolStripItemTextRenderEventArgs.cs
- NativeBuffer.cs
- TranslateTransform.cs
- InertiaRotationBehavior.cs
- AnimationLayer.cs
- WebPartEditorOkVerb.cs
- TextEditorDragDrop.cs
- IdentityHolder.cs
- QilGenerator.cs
- BuilderPropertyEntry.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- Stack.cs
- UncommonField.cs
- RegexInterpreter.cs
- ProtocolElement.cs
- InlineObject.cs
- DrawingDrawingContext.cs
- EventLogPermissionEntry.cs
- AlignmentXValidation.cs
- CheckBoxList.cs
- WmlObjectListAdapter.cs
- DataRecordObjectView.cs
- XmlQueryContext.cs
- ThreadStateException.cs
- TrackingExtract.cs
- AssemblyHash.cs
- Action.cs
- StyleTypedPropertyAttribute.cs
- PrinterSettings.cs
- UnicastIPAddressInformationCollection.cs
- DataGridRelationshipRow.cs
- GenericWebPart.cs
- HttpContext.cs
- Typography.cs
- ArgumentNullException.cs
- NativeMethods.cs
- EventToken.cs
- StringValidator.cs
- WebPartVerbCollection.cs
- FormsAuthenticationTicket.cs
- SafeHandles.cs
- arclist.cs
- BoundField.cs
- XmlWrappingReader.cs
- ToolStripPanel.cs
- KeyEvent.cs
- UniformGrid.cs
- ACL.cs
- SafeCertificateContext.cs
- ConnectivityStatus.cs
- Encoder.cs
- Win32.cs
- SafeBitVector32.cs
- PropertiesTab.cs
- Rect3D.cs
- BaseCollection.cs
- StringComparer.cs
- WorkflowMarkupSerializationProvider.cs
- PerformanceCounterLib.cs
- ContentDisposition.cs
- FormClosingEvent.cs
- RadioButton.cs
- TemplateControl.cs
- GC.cs
- MexHttpsBindingElement.cs
- _Rfc2616CacheValidators.cs
- SchemaTypeEmitter.cs
- ComponentResourceManager.cs
- HttpModulesInstallComponent.cs
- XPathAncestorIterator.cs
- ProviderConnectionPointCollection.cs
- ContextInformation.cs
- SqlXml.cs
- CompensationHandlingFilter.cs
- UICuesEvent.cs
- BitmapInitialize.cs
- TreeNodeMouseHoverEvent.cs