locked
When do we need to use the using keyword for windows 8 store apps?

    Question

  • Hi,

    When do we need to use the using keyword for windows 8 store apps? I am new to Windows 8 Store Apps. I see most windows 8 store apps code from MSDN don't have it.

    I am not sure if the using key word is deprecated for Windows 8.For example:

    using(var client = new HttpClient())

    {

    // Business code

    }

    Thanks and Best Regards,

    Weera




    Thursday, September 25, 2014 6:38 AM

Answers

  • You're not required to use it at all.  It's useful when you want an object to go out of scope when you're done using it.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, September 25, 2014 7:51 PM
    Moderator