TreeNodeBindingDepthConverter.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebControls / TreeNodeBindingDepthConverter.cs / 1 / TreeNodeBindingDepthConverter.cs

                            namespace System.Web.UI.Design.WebControls { 
    using System;
    using System.ComponentModel;

    public class TreeNodeBindingDepthConverter : Int32Converter { 
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
            string strValue = value as string; 
            if ((strValue != null) && (strValue.Length == 0)) { 
                return -1;
            } 

            return base.ConvertFrom(context, culture, value);
        }
 
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
            if ((value is int) && ((int)value == -1)) { 
                return String.Empty; 
            }
 
            return base.ConvertTo(context, culture, value, destinationType);
        }
    }
} 

// 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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK