Git Product home page Git Product logo

codingguidelines's Introduction

NuGet Status

Build Status

Coding Snippets Repository

Coding Snippets Extension

Coding Guidelines / Design Guidelines

A repository to contain IntelliTect's tools for coding conventions. https://intellitect.github.io/CodingGuidelines/

00XX block - Naming

INTL0001 - Fields _PascalCase

Fields should be specified in _PascalCase. Always with a leading underscore, regardless of visibility modifier.

Allowed

class SomeClass
{
    public string _MyField;
}

Disallowed

class SomeClass
{
    public string _myField;
    public string myField;
}

INTL0002 - Properties PascalCase

Fields should be PascalCase

Allowed

class SomeClass
{
    public string MyProperty { get; set; }
}

Disallowed

class SomeClass
{
    public string myProperty { get; set; }
    public string _MyProperty { get; set; }
}

INTL0003 - Methods PascalCase

Methods, including local functions, should be PascalCase

Allowed

class SomeClass
{
    public string GetEmpty() {

        var output = LocalFunction();

        string LocalFunction() {
            return string.Empty();
        }

        return output;
    }
}

Disallowed

class SomeClass
{
    public string getEmpty() {

        var output = localFunction();

        string localFunction() {
            return string.Empty();
        }

        return output;
    }
}

01XX block - Formatting

INTL0101 - Attributes on separate lines

All attributes should be on separate lines and be wrapped in their own braces.

Allowed

[FooClass]
[BarClass]
class SomeClass
{
    [Foo]
    [Bar]
    public string MyProperty { get; set; }
}

Disallowed

[FooClass, BarClass]
class SomeClass
{
    [Foo][Bar]
    public string MyProperty { get; set; }
}

03XX block - Performance

INTL0301 - Favor using the method EnumerateFiles over the GetFiles method.

When using the System.IO.Directory class, it is suggested to use the EnumerateFiles static method instead of the GetFiles method. In the remarks section of the documentation, it is stated that using the EnumerateFiles method is more efficient because you can start enumerating the collection before all the results are returned:

The EnumerateFiles and GetFiles methods differ as follows: When you use EnumerateFiles, you can start enumerating the collection of names before the whole collection is returned; when you use GetFiles, you must wait for the whole array of names to be returned before you can access the array. Therefore, when you are working with many files and directories, EnumerateFiles can be more efficient. The returned collection is not cached; each call to the GetEnumerator on the collection will start a new enumeration.

INTL0302 - Favor using the method EnumerateDirectories over the GetDirectories method.

When using the System.IO.Directory class, it is suggested to use the EnumerateDirectories static method instead of the GetDirectories method. In the remarks section of the documentation, it is stated that using the EnumerateDirectories method is more efficient because you can start enumerating the collection before all the results are returned:

The EnumerateDirectories and GetDirectories methods differ as follows: When you use EnumerateDirectories, you can start enumerating the collection of names before the whole collection is returned; when you use GetDirectories, you must wait for the whole array of names to be returned before you can access the array. Therefore, when you are working with many files and directories, EnumerateDirectories can be more efficient. The returned collection is not cached; each call to the GetEnumerator on the collection will start a new enumeration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.