R
reycri
While the following is allowed:
if (a == b)
SomeFunction();
else
OtherFunction();
The following is not:
try
DoSomething();
catch (Exception e)
ProcessError(e);
I checked the C# grammar and it confirms that, unlike all other
compound statements, it requires a block - ie: the opening { and
closing } are required.
I just want to be able to write the following (to avoid too many
indents):
try
using (FileStream file = new FileStream("someFile.txt",
FileMode.OpenOrCreate))
using (SomeResource rsrc = new SomeResource())
{
// do stuff here
}
catch (Exception e)
{
// handle error here
}
if (a == b)
SomeFunction();
else
OtherFunction();
The following is not:
try
DoSomething();
catch (Exception e)
ProcessError(e);
I checked the C# grammar and it confirms that, unlike all other
compound statements, it requires a block - ie: the opening { and
closing } are required.
I just want to be able to write the following (to avoid too many
indents):
try
using (FileStream file = new FileStream("someFile.txt",
FileMode.OpenOrCreate))
using (SomeResource rsrc = new SomeResource())
{
// do stuff here
}
catch (Exception e)
{
// handle error here
}