Since version
is a string
, you're hitting the overload of WriteLine
that accepts a category as its second parameter.
While there are any number of hacks to get around this behavior (I'll include a few below, for fun) I would personally prefer your solution as the preferable way of clearly ensuring that the string is treated as a format string.
Some other hacky workarounds:
Debug.WriteLine("Metadata Version: {0}", version, "");
Debug.WriteLine("Metadata Version: {0}", (object)version);
Debug.WriteLine("Metadata Version: {0}", new[] { version });
Debug.WriteLine("Metadata Version: {0}", version, null);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…