Правильная запись в StringBuilder - C#
Формулировка задачи:
Добрый день, подскажите, как правильно и красиво переделать следующие строки кода:
fileContent = new StringBuilder();
fileContent.AppendLine("using System.Drawing;");
fileContent.AppendLine("using System;");
fileContent.AppendLine("using System.Reflection;");
fileContent.AppendLine("using System.Windows.Forms;");
fileContent.AppendLine("namespace programm{");
fileContent.AppendLine("\tpublic class Form1 : Form {");
fileContent.AppendFormat("\t\tprivate string fileName = \"{0}\";\n", form.modelTreeView.SelectedNode.Text.ToLower().Equals("standart") ? @"StandartFreeModel.dll" : form.modelTreeView.SelectedNode.Text);
fileContent.AppendLine("\t\tprivate string className = \"BuildForm\";");
fileContent.AppendLine("\t\tprivate string methodName = \"build\";");
fileContent.AppendLine("\t\tprivate object[] param = null;");
fileContent.AppendLine("\t\tpublic Form1(){");
fileContent.AppendLine("\t\t\tSize = new Size(600, 350);");
fileContent.AppendLine("\t\t\trunMethodFromDll();");
fileContent.AppendLine("\t\t}");
fileContent.AppendLine("\t\t[STAThread]");
fileContent.AppendLine("\t\tpublic static void Main(){");
fileContent.AppendLine("\t\t\tApplication.EnableVisualStyles();");
fileContent.AppendLine("\t\t\tApplication.Run(new Form1());");
fileContent.AppendLine("\t\t}");
fileContent.AppendLine("\t\tpublic void runMethodFromDll(){");
fileContent.AppendFormat("\t\t\tobject[] defaultParam = new object[] {{ this.Controls, @\"{0}\", @\"{1}\"}};\n", form.connString, form.databaseType);
fileContent.AppendLine("\t\t\tAssembly asm = Assembly.LoadFrom(fileName);");
fileContent.AppendLine("\t\t\tType classObject = asm.GetType(fileName.Replace(\"dll\", \"\") + className);");
fileContent.AppendLine("\t\t\tdynamic st = Activator.CreateInstance(classObject, defaultParam);");
fileContent.AppendLine("\t\t\tMethodInfo method = classObject.GetMethod(methodName);");
fileContent.AppendLine("\t\t\tmethod.Invoke(st, param);");
fileContent.AppendLine("\t\t}");
fileContent.AppendLine("\t}");
fileContent.AppendLine("}");Решение задачи: «Правильная запись в StringBuilder»
textual
Листинг программы
fileContent = new StringBuilder();
fileContent.AppendLine(@"
using System.Drawing;
using System;
using System.Reflection;
using System.Windows.Forms;
namespace programm{....
");