Doing "using" with CodeDom?

G

Guest

Is there any way to do "using" with the CodeDom?

using(SqlConnection connnection = new SqlConnection("..."))
{
}

Kevin
 
D

Damien

Is there any way to do "using" with the CodeDom?

using(SqlConnection connnection = new SqlConnection("..."))
{

}

Kevin

No, because using is a language specific facility. You'll have to go
the long way around and do:
SQLConnection connection = new SqlConnection("...");
try
{

}
finally
{
connection.Dispose();
}

which is the equivalent. I'm a VBer, and face similar hurdles with
SyncLock and While (both of which *do* have equivalents in C#, but are
somehow ommitted from the CodeDOM)

Damien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top