do unsafe
, while (...) unsafe
, and else unsafe
, and more...
#8493
-
For title, in C#, you can if (...) unsafe
{
// ...
} while (...) unsafe
{
// ...
} And do unsafe
{
// ...
}
while (...); if (...)
{
// ...
}
else unsafe
{
// ...
} lock (...) unsafe
{
// ...
}
using (...) unsafe
{
// ...
} But this way ( if (...) unsafe
{
// ...
} Sometimes, I don't like so many code blocks, Especially |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It's actually brace-less blocks with nested
and the "standard" format should be putting the inner block on new line like this:
There is a convention to cancel the indentation if the inner and outer blocks are both |
Beta Was this translation helpful? Give feedback.
-
So... like this if (...) unsafe
{
lock (...) using (...) try
{
foreach (...) fixed (...) checked
{
}
}
finally
{
}
}
else do unchecked
{
} while (...); After formatting if (...) unsafe
{
lock (...) using (...) try
{
foreach (...) fixed (...) checked
{
}
}
finally
{
}
}
else do unchecked
{
} while (true); 🤔🤔🤣 |
Beta Was this translation helpful? Give feedback.
It's actually brace-less blocks with nested
unsafe
. You can mix many of brace-less constructs like this:and the "standard" format should be putting the inner block on new line like this:
There is a convention to cancel the indentation if the inner and outer blocks are both
using
s. But for usual cases, every nesting level will increase the level of indentation.