static void Main(string[] args) { int id; string name, departmentName; Console.WriteLine("enter the id:"); id = int.Parse(Console.ReadLine()); Console.WriteLine("enter the Name"); name = Console.ReadLine(); Console.WriteLine("enter the DepartmentName"); departmentName = Console.ReadLine(); Employee emp = new Employee(id, name, departmentName); emp.methodCalled += new methodDelegate(MethodCalling); Console.WriteLine("ID:" + emp.GetId()); Console.WriteLine("Name:" + emp.GetName()); Console.WriteLine("Department name:" + emp.GetDepartmentName()); Console.WriteLine("enter the updated id:"); id = int.Parse(Console.ReadLine()); Console.WriteLine("enter the updated Name"); name = Console.ReadLine(); Console.WriteLine("enter the updated DepartmentName"); departmentName = Console.ReadLine(); emp.UpdateProperty(id, name); Console.WriteLine("updated ID:" + emp.GetId()); Console.WriteLine("updated Name:" + emp.GetName()); Console.WriteLine("updated Department name:" + emp.GetDepartmentName()); }
static void Main(string[] args) { Employee e = new Employee(); e.SetName("Joe"); Console.WriteLine(e.GetName()); Console.ReadKey(); }
static void Main(string[] args) { int id; string name; string dpname; Console.WriteLine("Enter the Employee Id:"); id = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the Employee name"); name = Console.ReadLine(); Console.WriteLine("Enter the Department Name"); dpname = Console.ReadLine(); void pId() { Console.WriteLine("GetId() is called"); } void pName() { Console.WriteLine("GetName() is called"); } void pdpname() { Console.WriteLine("GetDepartmentName() is called"); } Employee emp = new Employee(id, name, dpname); emp.caller1 += new CallDelegate(pId); emp.caller2 += new CallDelegate(pName); emp.caller3 += new CallDelegate(pdpname); Console.WriteLine("Employee ID:" + emp.GetId()); Console.WriteLine("Employee Name:" + emp.GetName()); Console.WriteLine("Employee Department Name:" + emp.GetDepartmentName()); Console.WriteLine(" Update Employee Id"); id = int.Parse(Console.ReadLine()); Console.WriteLine("Updated Employee ID is:" + emp.update(id)); Console.WriteLine("Update Employee name"); name = Console.ReadLine(); Console.WriteLine("Updated Employee name is:" + emp.update(name)); emp.update(); }