Is there a TextWriter interface to the System.Diagnostics.Debug class?

前端 未结 4 1631
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 22:16

I\'m often frustrated by the System.Diagnostics.Debug.Write/WriteLine methods. I would like to use the Write/WriteLine methods familiar from the TextWriter class, so I ofte

4条回答
  •  臣服心动
    2020-12-30 22:55

    With C# 6 and later versions string interpolation is the answer for most formatting of strings. So the example would look like:

    Debug.WriteLine($"# entries {countOfEntries} for connection {connection}");
    

提交回复
热议问题