Editorconfig Guide

Generate your .editorconfig file with ease.

[*]

global options

if(true) {
··return;
}
if(true) {
··return;
}
if(true) {\n
··return;\n
}
if(true) {
··return;
}
if(true) {
··return;
}\n
Newline created after
80 characters
First line in file:

dotnet options

public void A(int a🗲) {
  return 1;
}
private void B(int b🗲) {
  return 1;
}
var value = obj ?? other;
var obj = new {
  first,
  second
};
if (obj is null) { }
PropertyName = ...;
var value = (a.b).Length;
var value = condition
  ? trueValue
  : falseValue;
var value = a || (b && c);
var obj = new Object {
  Member = true,
};
private readonly int f = 0;
using System;
using A;
using B;
var tuple = (
  first: 1,
  second: 2
);
var first = tuple.first;
List<int> list = [1, 2, 3];
Event += handler;
var tuple = (first, second);
namespace Proj.Folder.Data
is in /Folder/Data
List<int> list = [1, 2, 3];
internal class Class() {
  public void Method() { }
}
public interface IFace {
  void Method();
}
var value = a + (b * c);
private int _member;
var v = (a > b) && (c > d);
fieldName = ...;
var v = $"{val}";
return condition
  ? trueValue
  : falseValue;
return condition;
var value = obj?.Member;
public class A {
#pragma warning disable IDE0051
  public int a; //in use
#pragma warning restore IDE0051
}
public int Prop { get; set; }
using System;
using A;
using B;
var value = int.MaxValue;
a += b;
Method();
var list = new List<object>();
foreach (string item in list.Cast<string>()) { }

csharp options

var x = new int[10];
Func<int, int> square = x =>  { return x * x; };
var x = y.Method();
bool x = GetVal();
_ = GetVal();
var x = a + b;
readonly struct Point
{
  public int x;
}
(x, y) = (y, x);
int.TryParse(s, out int x);
try {
  x++;
}
catch(Exception e) {
  x--;
}
if(true) {
  x++;
}
var x = y.Method();
Func<int, int> square =
  x => x * x;
int x = 0;
Method(x, y);
var x = new {
  A = 1,
  B = 2
};
void Method(int x) {}
var query = from x in y
           where x > 0
           select x;
public int this[int index]
{
  get { return _values[index]; }
}
_ = GetVal();
if (o is string s)
{
  return s;
}
class A : B {}
var (x, y) = GetPoint();
public string Name
{
  get { return _name; }
  set { _name = value; }
}
if(o is default(int)
   or > (default(int)))
var s = new byte[] { 65, 66 };
var x = new Type {
  A = 1,
  B = 2
};
var result = value switch
{
  1 => "one",
  2 => "two",
  _ => "unknown"
};
var x = (int) y;
switch(x) {
  case 1:
    x++;
    break;
}
try {
  x++;
}
finally {
  x--;
}
if (true) { x++; }
if (true) {
  x++;
}
if(o is not C c)
numberStrings
  .Select(int.Parse);
public Person(string name)
{
  Name = name;
}
void Main()
{
  static void LocalFunc() { }
}
var x = new int[10];
if(cond) {
  x++;
}
else {
  x--;
}
public static Person operator +(Person a, Person b)
{
  return new Person(a.Name + b.Name);
}
switch(x) {
  case 1:
    x++;
    break;
}
if (o is null)
var x = y ?? throw new ArgumentNullException();
class A : B {}
namespace MyNamespace
{
  class MyClass { }
}
Method();
struct Point
{
  public readonly int x;
}
var x = list[1..3];
List<int> x = new();
using System;

namespace MyNamespace
{
var x = list[0];
if (o is string s)
{
  return s;
}
Console.WriteLine("Hello");
var list = [1, 2, 3];
var i = 0; var name = "Test";
switch(x) {
  case 1:
    {
      x++;
      break;
    }
}
line is
  { Start.Y: 0 }
  or { End.Y: 0 };
for (int i = 0; i < 10; i++) {}
condition?.Invoke();
Method(x, y);
public int X { get; set; }
var list = [1, 2, 3];
{
  if(cond)
  {
    goto error;
  error:
    log.Error();
  }
}
public string GetName()
{
  return Name;
}
var x = new int[] {};
List<int> x = new List<int>();
void Method() {}
class Person(string name) { }
if(true)
{
  x++;
}
for (int i = 0; i < 10; i++) {}
int x = 1;
void Method(int x) {}
public string Name
{
  get { return _name; }
}
using var stream =
  new FileStream(
    "file.txt",
    FileMode.Open);
int Square(int x)
{
  return x * x;
}

visual-basic options