Usage of using key word

Usage of using key word

if you are handling with dataset or datatable in your code all are suggest to donot forget dispose like that
that is the good suggestion because it will occupy more memory

example for without using keyword

DataSet ds = new DataSet();
ds.Dispose ();

example for with using keyword

using (DataSet dss = new DataSet())
ds.Tables[0].Rows[0][0] = "veera";

in first example we are using dispose method to dispose the dataset object but in second example we are not using dispose method
because using () keyword automatically dispose the dataset object

so if you forget to dispose always you use using keyword it will automatically do

:) donot worry about dispose using keyword take care of it



No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: