Thursday, 17 May 2018

Properties in C#







using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication20

{

    class Program

    {

        static void Main(string[] args)

        {

            EMPLOYEE EMP = new EMPLOYEE();

            Console.WriteLine("Enter the ID: ");

            EMP.ID = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter the name ");

            EMP.NAME = Console.ReadLine();

            Console.WriteLine("Enter the salary ");

            EMP.SALARY = float.Parse(Console.ReadLine());



            EMP.display();

     

        }

    }

}
-------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication20
{
    class EMPLOYEE
    {
        public int ID { get; set; }
        public string NAME { get; set; }

        public float SALARY { get; set; }
   
    public void display()
        {

            Console.WriteLine("ID: "+ID);
            Console.WriteLine("Name "+NAME);
            Console.WriteLine("Salary: "+SALARY);

        }
   
    }
}


No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...