3 ms·
wow that totally fails to explain what nameof is. It seems to be a tiny bit similar to the C preprocessor's stringize, #include <boost/preprocessor/string
by jepler 9y ago
wow that totally fails to explain what nameof is. It seems to be a tiny bit similar to the C preprocessor's stringize,
#include <boost/preprocessor/stringize.hpp>
#include <stdio.h>
int main() {
puts(BOOST_PP_STRINGIZE(3)); // will print "3\n"
}
except that it can take a qualified name (like person.address.ZipCode) and return just the last component (this is documented by Microsoft as resulting in the string "ZipCode") https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof https://docs.microsoft.com/en-us/dotnet/csharp/language-refe... https://stackoverflow.com/questions/31695900/what-is-the-purpose-of-nameof https://stackoverflow.com/questions/31695900/what-is-the-pur...