@@ -35,8 +35,8 @@ public Disassembler(CSharpCompilationOptions compilationOptions, AssemblyReferen
3535 this . referenceService = referenceService ;
3636
3737 // we will try to compile the user's code several different ways. The first one that succeeds will be used.
38- this . compilers = new ( string name , CompileDelegate compile ) [ ]
39- {
38+ this . compilers =
39+ [
4040 // "console application" will work for standalone statements, due to C#'s top-level statement feature.
4141 ( name : "Console Application (with top-level statements)" ,
4242 compile : ( code , optimizationLevel ) => Compile ( code , optimizationLevel , OutputKind . ConsoleApplication ) ) ,
@@ -46,7 +46,7 @@ public Disassembler(CSharpCompilationOptions compilationOptions, AssemblyReferen
4646 // Compiling as a script will work for most other cases, but it's quite verbose so we use it as a last resort.
4747 ( name : "Scripting session (will be overly verbose)" ,
4848 compile : ( code , optimizationLevel ) => scriptRunner . CompileTransient ( code , optimizationLevel ) )
49- } ;
49+ ] ;
5050 }
5151
5252 public EvaluationResult Disassemble ( string code , bool debugMode )
@@ -88,7 +88,7 @@ public EvaluationResult Disassemble(string code, bool debugMode)
8888 . Select ( line => line . TrimEnd ( ) ) // output has trailing spaces on some lines, clean those up
8989 )
9090 + string . Join ( '\n ' , commentFooter ) ;
91- return new EvaluationResult . Success ( code , ilCode , Array . Empty < MetadataReference > ( ) ) ;
91+ return new EvaluationResult . Success ( code , ilCode , [ ] ) ;
9292 }
9393
9494 // failure, we couldn't compile it, move on to the next compiler configuration.
@@ -118,7 +118,7 @@ private static PlainTextOutput DisassembleFile(PEFile file)
118118 var asmReader = asm . GetMetadataReader ( ) ;
119119 var definedTypes = asmReader . TypeDefinitions . ToArray ( ) ;
120120 var definedTypeNames = definedTypes . Select ( t => asmReader . GetString ( asmReader . GetTypeDefinition ( t ) . Name ) ) . ToArray ( ) ;
121- if ( definedTypeNames . Except ( new [ ] { "<Module>" , "Program" , "RefSafetyRulesAttribute" , "EmbeddedAttribute" } ) . Any ( ) )
121+ if ( definedTypeNames . Except ( [ "<Module>" , "Program" , "RefSafetyRulesAttribute" , "EmbeddedAttribute" ] ) . Any ( ) )
122122 {
123123 new ReflectionDisassembler ( ilCodeOutput , CancellationToken . None ) . WriteModuleContents ( file ) ; // writes to the "ilCodeOutput" variable
124124 return ilCodeOutput ;
@@ -133,7 +133,7 @@ private static PlainTextOutput DisassembleFile(PEFile file)
133133 var programType = asmReader . GetTypeDefinition ( definedTypes [ programTypeIndex ] ) ;
134134 var methods = programType . GetMethods ( ) . ToArray ( ) ;
135135 var methodNames = methods . Select ( m => asmReader . GetString ( asmReader . GetMethodDefinition ( m ) . Name ) ) . ToArray ( ) ;
136- if ( methodNames . Except ( new [ ] { "<Main>$" , ".ctor" } ) . Any ( ) )
136+ if ( methodNames . Except ( [ "<Main>$" , ".ctor" ] ) . Any ( ) )
137137 {
138138 return DisassembleAll ( file , ilCodeOutput ) ;
139139 }
@@ -153,7 +153,7 @@ private Compilation Compile(string code, OptimizationLevel optimizationLevel, Ou
153153 {
154154 var ast = CSharpSyntaxTree . ParseText ( code , new CSharpParseOptions ( LanguageVersion . Latest ) ) ;
155155 var compilation = CSharpCompilation . Create ( "CompilationForDisassembly" ,
156- new [ ] { ast } ,
156+ [ ast ] ,
157157 referenceService . LoadedReferenceAssemblies ,
158158 compilationOptions
159159 . WithOutputKind ( outputKind )
0 commit comments