AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.41k stars 287 forks source link

csharp_style_var_when_type_is_apparent to true #863

Closed Barsonax closed 4 years ago

Barsonax commented 4 years ago

This style change makes it so that the explicit type is no longer needed when the type is apparent. This leads to more concise code and cleans up the find all references results without sacrificing readability.

Some examples: Before:

List<string> auxilLibs = new List<string>();

After

var auxilLibs = new List<string>();

Before

ICmpInitializable cInit = this as ICmpInitializable;

After

var cInit = this as ICmpInitializable;

However a case like this will still require a explicit type. Even though a method named CreateCmpInitializable would probably return a ICmpInitializable its not a given as method can be given a name that might not properly communicate its intent.

ICmpInitializable cInit = CreateICmpInitializable();

NOTE: this PR only changes the style rules and does not change any code!