LowerCaseStringConverter.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Configuration / LowerCaseStringConverter.cs / 1305376 / LowerCaseStringConverter.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

/***************************************************************************** 
     From machine.config 
        
        
 
            
            

                 
                 
                        
                 

            

             
            
 
        

        
            
 
                 
                
             
            
        

    ******************************************************************************/ 

namespace System.Web.Configuration { 
    using System; 
    using System.Xml;
    using System.Configuration; 
    using System.Collections.Specialized;
    using System.Collections;
    using System.Globalization;
    using System.IO; 
    using System.Text;
    using System.Web.Util; 
    using System.ComponentModel; 
    using System.Security.Permissions;
 
    public sealed class LowerCaseStringConverter : TypeConverter {
        public override bool CanConvertTo(ITypeDescriptorContext ctx, Type type) {
            return (type == typeof(string));
        } 
        public override bool CanConvertFrom(ITypeDescriptorContext ctx, Type type) {
            return (type == typeof(string)); 
        } 
        public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) {
            if (value == null) { 
                return String.Empty;
            }

            return ((string)value).ToLower(CultureInfo.InvariantCulture); 
        }
        public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { 
            Debug.Assert(data != null); 
            Debug.Assert(data is string);
 
            return ((string)data).ToLower(CultureInfo.InvariantCulture);
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

/***************************************************************************** 
     From machine.config 
        
        
 
            
            

                 
                 
                        
                 

            

             
            
 
        

        
            
 
                 
                
             
            
        

    ******************************************************************************/ 

namespace System.Web.Configuration { 
    using System; 
    using System.Xml;
    using System.Configuration; 
    using System.Collections.Specialized;
    using System.Collections;
    using System.Globalization;
    using System.IO; 
    using System.Text;
    using System.Web.Util; 
    using System.ComponentModel; 
    using System.Security.Permissions;
 
    public sealed class LowerCaseStringConverter : TypeConverter {
        public override bool CanConvertTo(ITypeDescriptorContext ctx, Type type) {
            return (type == typeof(string));
        } 
        public override bool CanConvertFrom(ITypeDescriptorContext ctx, Type type) {
            return (type == typeof(string)); 
        } 
        public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) {
            if (value == null) { 
                return String.Empty;
            }

            return ((string)value).ToLower(CultureInfo.InvariantCulture); 
        }
        public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { 
            Debug.Assert(data != null); 
            Debug.Assert(data is string);
 
            return ((string)data).ToLower(CultureInfo.InvariantCulture);
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.

                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK