Monday, September 18, 2017

In below code finally statement get executed?


 public class A
    {
        public bool Print()
        {
            try
            {
                throw new ArgumentNullException();
            }
            catch (Exception ex)
            {
                return true;
            }
            finally
            {
            }
            return true;
        }
    }

The answer is yes. Statements within the finally block will be executed always.

No comments:

Post a Comment