Difference between nameof and typeof
问题 Correct me if I am wrong, but doing something like var typeOfName = typeof(Foo).Name; and var nameOfName = nameof(Foo); should give you exactly the same output. One of the understandable reasons according to this source: https://msdn.microsoft.com/en-us/library/dn986596.aspx is that "Using nameof helps keep your code valid when renaming definitions" If you want to get the class instance as string it is not possible to do something like that: var fooInstance = new Foo(); var nameOfName =