DesignBinding.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / DesignBinding.cs / 1 / DesignBinding.cs

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

namespace System.Windows.Forms.Design { 
 
    using System;
    using System.ComponentModel; 
    using System.Drawing.Design;
    using System.Globalization;

    [ 
    Editor("System.Windows.Forms.Design.DesignBindingEditor, " + AssemblyRef.SystemDesign,typeof(UITypeEditor))
    ] 
    internal class DesignBinding { 

        private object dataSource; 
        private string dataMember;

        public static DesignBinding Null = new DesignBinding(null, null);
 
        public DesignBinding(object dataSource, string dataMember) {
            this.dataSource = dataSource; 
            this.dataMember = dataMember; 
        }
 
        public bool IsNull {
            get {
                return (dataSource == null);
            } 
        }
 
        public object DataSource { 
            get {
                return dataSource; 
            }
        }

        public string DataMember { 
            get {
                return dataMember; 
            } 
        }
 
        public string DataField {
            get {
                if (String.IsNullOrEmpty(dataMember)) {
                    return String.Empty; 
                }
 
                int lastDot = dataMember.LastIndexOf("."); 
                if (lastDot == -1) {
                    return dataMember; 
                } else {
                    return dataMember.Substring(lastDot+1);
                }
            } 
        }
 
        public bool Equals(object dataSource, string dataMember) { 
            return (dataSource == this.dataSource && String.Equals(dataMember, this.dataMember,  StringComparison.OrdinalIgnoreCase));
        } 
    }

}

// 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