im trying to use Environment.CurrentDirectory with a public const string
public const string MsgPath = Environment.CurrentDirectory + @"values\messages.txt";
but it wont let me
Use Environment.CurrentDirectory with a public const strin
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted May 28, 2013, 9:43 AM EDT
The value of MsgPath depends on a call at run time to the method, Environment.CurrentDirectory, and so can't be declared 'const'.
However, you can declare it to be 'static readonly' which is just as good for most purposes:
pubic static readonly string MsgPath = Environment.CurrentDirectory + @"values\messages.txt";