public static string ExecuteSnippet(string[] snippet, string[] imports) { var usingNamespaces = ExecutorOptions.GetDefaultImports().Union(imports).ToArray(); var sourceCode = Generator .CreateProgramForSnippet(snippet, usingNamespaces); try { return(Execute(sourceCode)); } catch (DynamicCompilationException e) { throw new DynamicCompilationException(e, Generator.SnippetLineStart + imports.Length - 2); } }
public static string ExecuteSnippet(string[] snippet) { return(ExecuteSnippet(snippet, ExecutorOptions.GetDefaultImports())); }