editorconfig name | possible values |
---|---|
dotnet_sort_system_directives_first | true , false |
editorconfig name | possible values |
---|---|
csharp_indent_block_contents | true , false |
csharp_indent_braces | true , false |
using System; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.MSBuild; | |
namespace ConsoleApplication11 | |
{ | |
class Program | |
{ |
using System; | |
using System.Collections; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.Text; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
using System.Collections.Generic; | |
using System.Linq; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var list = new List<int>(); | |
list.Where(x => x % 2 == 0).OrderByDescending(x => x) | |
.Select(x => x); |
using System.Collections.Generic; | |
using System.Linq; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var list = new List<int>(); | |
list.Where(x => x % 2 == 0) | |
.OrderByDescending(x => x) |
var compilation = project.GetCompilationAsync().Result; | |
var specificDiagnosticOptions = new[] { new KeyValuePair<string, ReportDiagnostic>(NotReportedByDefaultAnalyzer.DiagnosticId, ReportDiagnostic.Warn) }; | |
var options = new CSharpCompilationOptions(outputKind: OutputKind.DynamicallyLinkedLibrary, specificDiagnosticOptions: specificDiagnosticOptions); | |
var compilationWithOptions = compilation.WithOptions(options); | |
var compilationWithAnalyzers = compilationWithOptions.WithAnalyzers(ImmutableArray.Create(analyzer)); | |
var diags = compilationWithAnalyzers.GetAnalyzerDiagnosticsAsync().Result; |
using System.Collections.Generic; | |
using System.Collections.Immutable; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
using Microsoft.CodeAnalysis.Diagnostics; | |
using static Microsoft.CodeAnalysis.Diagnostic; | |
namespace Analyzer1 { | |
[DiagnosticAnalyzer(LanguageNames.CSharp)] |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp; | |
namespace GetTypeName | |
{ | |
class Program | |
{ |
var a = "\n"; // token.ValueText.Contains("\n") == true | |
var b = @"\n"; // token.ValueText.Contains("\n") == false | |
var c = @" | |
"; // token.ValueText.Contains("\n") == true | |
var d = $@"\n";// token.ValueText.Contains("\n") == false | |
var e = $@" | |
"; // token.ValueText.Contains("\n") == false |