In C#, which statement ensures an IDisposable object is disposed automatically at the end of a block?
Correct answer
C. using
19 views
C. using
19 views
The using statement calls Dispose() automatically, even if an exception occurs, which is ideal for files and database connections. lock is for thread synchronisation.
Asked in: NTS, PPSC, Technical Interviews
Not sure why the answer is C? Ask here and get an explanation.