Using Usage with Typed Dataset Table Adapters

Simple question. Is it important to use the using statement when working with typed dataset table adapters? Most of the examples I've seen on the net never use the using statement.

using (Data_ItemTableAdapter adapter = new Data_ItemTableAdapter())
{

    DataItemTable = a.GetDataByDataItemID(DataItemID);
    // more code here
}

Thanks for the help!

Edit: It seems that the general consensus is that it is probably a good idea to use “use” in this situation, because it certainly will not hurt, and it does not take much effort. Just not sure if it's worth going back through this old project and changing all the code. Thanks for the advice!

+3
source share
4 answers

IDisposable, , , using Dispose .

, , , , . , .

+6

someting IDisposable, , () . Dispose() + Try/finally ? .

+4

, , .

, , , , , , Dispose(), using.

+2

- dispose, , , , . dispose ( ) CG . CG , CG . CG, .

, , , , , , , , . , Dispose , , , - . using - .

GC .NET

+2
source

Source: https://habr.com/ru/post/1759150/


All Articles