Q:

In a “using” block is an OracleConnection closed

In a “using” block is an OracleConnection closed if System.Environment.Exit(0) is issued in the catch statement?
Example:
        OracleConnection oracleConnection = getOracleConnection();

        using (oracleConnection)
        {

            try
            {

                oracleConnection.Open();
                OracleCommand cmd = getApplicantsCmd(oracleConnection);
                OracleDataReader rdr = cmd.ExecuteReader(); 

                List<Applicant> applicants = new List<Applicant>();
                while (rdr.Read())
                {
                    Applicant applicant = new Applicant();
                    applicant.email = (string)rdr["GOREMAL_EMAIL_ADDRESS"];
                    applicants.Add(applicant);                   
                }

                return applicants;

            }
            catch (Exception ex)
            {
                Console.WriteLine("Failure getting applicant records: " + ex.Message);
                System.Environment.Exit(0);
                return null;
            }
        }

I want execution to stop if an exception is thrown while looking up the records.
Is there a better way to handle this?  

A:

The physical connection to the database is not closed. It's just returned to the ADO.NET connection pool for reuse. ADO.NET keeps a pool of connections to avoid opening a physical connection to the database everytime you want to perform a SQL query. You should also wrap your OracleCommand and OracleDataReader in using statements to ensure proper disposal even in the event of an exception.

A:

There will be no call to oracleConnection's Dispose() method after the call of System.Environment.Exit, even though the variable is wrapped in using. If you would like to make sure that the connection is disposed, either put the using inside try/catch, or do not call System.Environment.Exit inside using. You can still exit if you set a flag, and act upon it after the using statement:
var mustExit = false;
using (var oracleConnection = getOracleConnection()) {
    try {
        ...
    } catch {
        Console.WriteLine("Failure getting applicant records: " + ex.Message);    
        mustExit = true;
    }
}
if (mustExit) {
    System.Environment.Exit(0);                
}

