---
title: "\"Too many connections\""
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/171413-too-many-connections/page2"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "k0ffe"
published: "2008-05-12T16:55:29.000Z"
updated: "2008-05-15T20:51:06.000Z"
replies: 20
views: 900
page: 2
pages: 2
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/171413-too-many-connections"
---

# "Too many connections"

_Sida 2 av 2._

## #21 — spango, 2008-05-15T20:51Z

För att vidare klargöra hur using funkar, så är följande två snuttar helt ekvivalenta:

```
[I]Alt. 1[/I]
using(SomeResource s = new SomeResource()) {
    // gör nåt
}

[I]Alt. 2[/I]
SomeResource s = new SomeResource();
try {
    // gör nåt
} finally {
    if (s != null) ((IDisposable)s).Dispose();
}
```

Inga konstigheter alltså, bara lite syntaktiskt socker från våra välvilliga härskare i Redmond :)

Permalänk: https://www.webforum.nu/p/2110429

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/171413-too-many-connections/page2  
Föregående sida: https://www.webforum.nu/amne/dotnet/171413-too-many-connections.md
