Other Statements: lock, using, try-catch-finally, checked/unchecked, and yield

The following statements are covered in other chapters.


The lock statement provides exclusive access to a thread; see Chapter 31.


The using statement is used in two ways. The first is to specify namespaces, which is covered in Chapter 3. The second use is to ensure that Dispose() is called at the end of a block, which is covered in detail in Chapter 8.


The try, catch, and finally statements control exception handling; see Chapter 4.


The checked and unchecked statements control whether exceptions are thrown if conversions or expressions overflow; see Chapter 14.

Source: Gunnerson Eric, Wienholt Nick (2005), A Programmer’s Introduction to C# 2.0, Apress; 3rd edition.

Leave a Reply

Your email address will not be published. Required fields are marked *