I suppose stringof works the same way. For example, analog D with the first C # example in this link:
void f(string s) { if (s == null) throw new Exception(s.stringof ~ " is null!"); }
There is also std.traits.fullyQualifiedName . He does what he says on the bank:
module mymodule; import std.traits : fullyQualifiedName; class MyClass { int myvar; } pragma(msg, MyClass.myvar.stringof);
As you can see from the first link, fullyQualifiedName may be more suitable for generating compile-time code, where it helps to be as specific as possible in order to avoid collision with local characters.
source share