Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6623791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:34:28+00:00 2026-05-25T21:34:28+00:00

This was a telephone interview question I had: Is there a time when Dispose

  • 0

This was a telephone interview question I had: Is there a time when Dispose will not be called on an object whose scope is declared by a using block?

My answer was no – even if an exception happens during the using block, Dispose will still be called.

The interviewer disagreed and said if using is wrapped in a try–catch block then Dispose will not be called by the time you enter the catch block.

This goes contrary to my understanding of the construct, and I haven’t been able to find anything that backs up the interviewers point of view. Is he correct or might I have misunderstood the question?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:34:28+00:00Added an answer on May 25, 2026 at 9:34 pm
    void Main()
    {
        try
        {
            using(var d = new MyDisposable())
            {
                throw new Exception("Hello");
            }
        }
        catch
        {
            "Exception caught.".Dump();
        }
    
    }
    
    class MyDisposable : IDisposable
    {
        public void Dispose()
        {
            "Disposed".Dump();
        }
    }
    

    This produced :

    Disposed
    Exception caught
    

    So I agree with you and not with the smarty interviewer…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had telephone interview question yesterday. The interviewer asked me if I had faced
I was recently asked this question in one of my telephonic interview. There is
Ok i have this: a:1:{i:0;a:3:{s:7:address;s:52:Elågåresgude 41, 2200 Københamm N;s:12:company_name;s:14:Kaffe og Kluns;s:9:telephone;s:0:;}} This does not
Just been asked this question as a true / false in a telephone job
Is there a regex way of redacting email & telephone info from this text:
I was asked this interview question today!! (it was a really awkward telephonic interview..):
I got this parameter: $objDbCmd.Parameters.Add(@telephone, [System.Data.SqlDbType]::VarChar, 18) | Out-Null; $objDbCmd.Parameters[@telephone].Value = $objUser.Telephone; Where the
This might seem like a stupid question I admit. But I'm in a small
This is a difficult and open-ended question I know, but I thought I'd throw
Could you please suggest me the best possible answer to this question for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.