0
I wish that all Console.WriteLine
this way when sent to the Console:
[10:38:12:758]- Message typed in writeline
Well I’ve already done a part that’s this:
private static DateTime data = DateTime.Now;
Console.WriteLine("[{0}]", data.ToString("HH:mm:ss:fff"));
However, I want to write several messages, and in case I would have to keep typing this code a lot of times, I wanted it to be something like this:
"CW("Message")" and already appeared the "Datetime now" in the format I quoted above, how can I do this?
I made this code:
public void msg(string mensagem)
{
mensagem = "";
Console.WriteLine("[{0}], [{1}]", data.ToString("HH:mm:ss:fff"), mensagem);
}
private void button1_Click(object sender, EventArgs e)
{
msg("Teste");
}
However, the message "Test"
Wouldn’t it be better to put all the code?
– Maniero
I edited and put the code
– Leonardo Araujo
This code makes no sense.
– Maniero
Yeah, I put something that didn’t make sense there haha
– Leonardo Araujo
You’re leaving the test variable without text there
mensagem = "";
– Barbetta
Do you want to write a message and add the date together? just don’t want to keep typing the date into every message ?
– Marco Souza
I’ve got a friend thanks.
– Leonardo Araujo