h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Use Ternary Operator in Business Layer in C#.Net

      Today we will discuss about the Ternary Operator in Business Layer in C#.Net.
Example for Ternary Operator :
Create a One Class for Business Layer called BLEmp.cs
Copy and paste in the BLEmp.cs File

Private static string _EmpName;
        public static string EmpName
        {
            get { return _EmpName == string.Empty ? "please Enter Name" : _EmpName; }
            set
            { _EmpName = value;   }
        }
 
Drag and Drop TextBox and Button on the form.
Copy and Paste this code in the Button Click Event
 
BLEmp.EmpName = textBox1.Text;
MessageBox.Show(BLEmp.EmpName);