Skip to content
| Marketplace
Sign in
Visual Studio>Tools>WCF Client Snippet
WCF Client Snippet

WCF Client Snippet

Robert MacLean

|
2,312 clicks
| (0) | Free
This is a Visual Studio snippet, which provides developers an easier and more complete way to correctly work with WCF clients (proxies) than using the the Using statement. For details see: http://msdn.microsoft.com/en-us/library/aa355056.aspx
Get Started

If you are implementing a WCF client it is often common to wrap that client in a Using statement or call dispose on it - however this way of working with it can cause a variety of problems. From a proven practices point of view,  you can use the wcf client snippet which produces 20 lines of code which has:

  • The try...catch correctly implemented
  • All likely exceptions listed in the catch statements
  • Correct placement of the close call in the try block
  • Correct placement of the abort calls in the catch statements

Installation is as easy as saving to the correct folder which changes depending on your version of Visual Studio:

  • 2005: C:\Users\<Username>\Documents\Visual Studio 2005\Code Snippets\Visual C#\My Code Snippets
  • 2008: C:\Users\<Username>\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets
  • 2010: C:\Users\<Username>\Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets
  • 2012: C:\Users\<Username>\Documents\Visual Studio 2012\Code Snippets\Visual C#\My Code Snippets
  • 2013: C:\Users\<Username>\Documents\Visual Studio 2013\Code Snippets\Visual C#\My Code Snippets
    • Contact us
    • Jobs
    • Privacy
    • Manage cookies
    • Terms of use
    • Trademarks
    © 2025 Microsoft