string text4 = Convert.ToString(DateTime.Now.Date);
....
text4.Substring(0, 10),
string text;
if (DateTime.Now.Second <= 9)
{
text = "0" + Convert.ToString(DateTime.Now.Second);
}
else
{
text = Convert.ToString(DateTime.Now.Second);
}
string text2;
if (DateTime.Now.Minute <= 9)
{
text2 = "0" + Convert.ToString(DateTime.Now.Minute);
}
else
{
text2 = Convert.ToString(DateTime.Now.Minute);
}
string text3;
if (DateTime.Now.Hour <= 9)
{
text3 = "0" + Convert.ToString(DateTime.Now.Hour);
}
else
{
text3 = Convert.ToString(DateTime.Now.Hour);
}
string text4 = Convert.ToString(DateTime.Now.Date);
string value = string.Concat(new string[]
{
text4.Substring(0, 10),
" ",
text3,
":",
text2,
":",
text
});
...
static void Main(string[] args)
{
%BLOCK_1%
//какой-то код
%BLOCK_2%
Console.ReadKey();
}
...
string code = File.ReadAllText(@"MyCompil.cs");
code =code.Replace("%BLOCK_1%", "string[] arr = new string[]{\"hello\",\"world\"};");
code =code.Replace("%BLOCK_2%", "foreach(var s in arr) Console.WriteLine(s);");