In C#, which statement ensures an IDisposable object is disposed automatically at the end of a block?
Correct answer
C. using
15 views
C. using
15 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.