4 ms·
If I were doing it that way, I wouldn't give the outer blocks' curly braces their own lines. For example in C#, where pretty much every file has a single "names
by jimrandomh 11y ago
If I were doing it that way, I wouldn't give the outer blocks' curly braces their own lines. For example in C#, where pretty much every file has a single "namespace" block containing a single "class" block, I write it as:
namespace SomeNamespace {
class SomeClass
{
//...
}}
Which avoids having shifted the whole file an extra indent level to the right. But I haven't seen anyone else doing this.
- Avshalom 11y agoI'm not writing C# but yeah: AS3 and Java both have the Package{class{ two-step before you actually write any code. I don't even indent inside class: package{ class{ main{ now we indent } }}
- threeseed 11y agoYou don't indent after a package e.g. https://github.com/apache/spark/blob/master/core/src/main/java/org/apache/spark/JavaSparkListener.java https://github.com/apache/spark/blob/master/core/src/main/ja... And it's fair enough to indent with a main since it is so infrequent. Ideally you only have one main entry point.