Wednesday, 21 August 2013

What is the correct way use of "using" in C#.NET?

What is the correct way use of "using" in C#.NET?

which approaches are correct about "using" (first or second)?
First:
using (DataTable dt = list.ToDataTable())
{
dataList.DataSource = dt;
dataList.DataBind();
}
Second:
using (DataTable dt = list.ToDataTable())
{
dataList.DataSource = dt;
}
dataList.DataBind();

No comments:

Post a Comment