[Serializable]class Employee{ int empId; Public int EmployeeID { get { return empid; } set {empid = value; } } }//Create an object of Employee classEmployee empObj = new Employee();empObj.EmployeeID = 1000;//Store Employee class object in ViewStateViewState["emp"] = empObj;//Retrieve Employee class object from ViewStateEmployee xyz = (Employee) ViewState["emp"];