- World's Largest Collection of Interview Questions
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.

  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!

    Send your Resume to 6000 Companies

    Question :
    How can I get around scope problems in a try/catch?
    Category C# Interview Questions
    Rating (0.2) By 40 users
    Added on 11/22/2011
    Views 262
    Rate it!

    If you try to instantiate the class inside the try, it'll be out of scope when you try to access it from the catch block. A way to get around this is to do the following: Connection conn = null;
    conn = new Connection();
    if (conn != null) conn.Close();
    By setting it to null before the try block, you avoid getting the CS0165 error (Use of possibly unassigned local variable 'conn').

    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

    Related Questions
    View Answer
    How do I get deterministic finalization in C#?
    View Answer
    What does assert() do in C#?
    View Answer
    What is a multicast delegate in C#?
    View Answer
    What is an interface class in C#?
    View Answer
    Describe the accessibility modifier protected internal?
    View Answer
    What does the This window show in the debugger?
    View Answer
    What is the role of the DataReader class in ADO.NET connections?
    View Answer
    What is the wildcard character in SQL?
    View Answer
    Why does my Windows application pop up a console window every time I run it?
    View Answer
    What is the data provider name to connect to Access database?
    View Answer
    What is a pre-requisite for connection pooling?
    View Answer
    Can you override private virtual methods?
    View Answer
    Can multiple catch blocks be executed?
    View Answer
    Does C# support multiple inheritance?
    View Answer
    Can you declare the override method static while the original method is non-static?
    View Answer
    Can you store multiple data types in System.Array?
    View Answer
    Does C# support C type macros?
    View Answer
    Does C# support parameterized properties?
    View Answer
    Does C# support templates?
    View Answer
    Does C# support #define for defining global constants?
    View Answer

    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here - Best Freshers & Experienced Jobs Website.

    View ALL C# Interview Questions

    User Options
    Sponsored Links

    Copyright ©2003-2015, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

    Cache = 0.0625 Seconds