Declare 2 types inside using statement gives compile error?
Posted
by citronas
on Stack Overflow
See other posts from Stack Overflow
or by citronas
Published on 2010-03-25T23:08:39Z
Indexed on
2010/03/25
23:13 UTC
Read the original article
Hit count: 275
c#
|using-statement
I want to use this line of code:
using (ADataContext _dc = new ADataContext(ConnectionString), BDataContext _dc2 = new BrDataContext(ConnectionString)){ // ...}
This gives a compile error:
Cannot use more than one type in a for, using, fixed or declartion statement.
I thought this was possible? MSDN says it is: http://msdn.microsoft.com/en-us/library/yh598w02%28VS.80%29.aspx In the MSDN sample code Font is used, which is class and thereby a reference type as well as my two DataContext classes.
What went wrong here? How does my attempt differ from the MSDN sample?
© Stack Overflow or respective owner