Reference variable in c#
For Example: Write a program to demonstrate the reference variable-
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication5
{
class
employee
{
public
int eid;
public
string empname;
public
string city;
public
string gender;
public
float salary;
}
class
Program
{
static
void Main(string[] args)
{
employee
e1 = new employee();
e1.eid=11;
e1.empname="Aryan";
e1.city="Barshi";
e1.gender="Male";
e1.salary=20000f;
Console.WriteLine("Employee
No: {0}",e1.eid);
Console.WriteLine("Name:
{0}", e1.empname);
Console.WriteLine("City:
{0}", e1.city);
Console.WriteLine("Gender:
{0}", e1.gender);
Console.WriteLine("Salary:
{0}", e1.salary);
Console.ReadLine();
}
} }
Output:
Comments
Post a Comment