Guest User

Guest User

  • Tech Writer
  • 357
  • 120.8k

Why do I need to instantiate object?

Jun 6 2012 5:53 PM
Hi

I have the following code:-

IOrderedDictionary rowValues = new IOrderedDictionary();
rowValues = GetValues(GridView1.Rows[i]);

CheckBox cbRemove = new CheckBox();
cbRemove = (CheckBox)GridView1.Rows[i].FindControl("Remove");

My question is why do I need to create a instance\object of the IOrderedDictionary and CheckBox classes?

I changed the code to 

IOrderedDictionary rowValues;
rowValues = GetValues(GridView1.Rows[i]);

CheckBox cbRemove;
cbRemove = (CheckBox)GridView1.Rows[i].FindControl("Remove");

And found that it still works at both compile and runtime?

Regards
Steven

Answers (4)