CS0103 Compiler Error when using C# 6.0 keyword nameof
Author: psimmons
Creation Date: 4/4/2018 11:05 PM
profile picture


I am trying to convert an enum to a string. I use C# keyword nameof.

Please log in to see this code.

This is working for me in Visual Studio, but not in Wealth-Lab where I get:
Compiler Error CS0103 The name 'nameof' does not exist in the current context

I can't see what I might be doing wrong. Is nameof supported by the compiler? Perhaps there is a reference I need to add?

profile picture


It appears that the Wealth-Lab 6.9 Strategy Editor targets .NET 4.5 and does not support C# 6.0 features such as nameof, auto-property initializers etc. As far as I understand, the Roslyn C# compiler requires .NET 4.6. Perhaps you could arrive at a similar functionality with System.Reflection.
profile picture


Thanks Eugene. I used Enum.GetName(typeof.....
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).