Reputation:
I really wanted to just use
Class MyClasses
{
public string mwaAHA = "here";
//and then use it like this:
static void testStringhere()
{
console.writeline(mwaAHA);
}
}
I'm doing something wrong can someone demo the eaist way I can make a few strings and use them in any void?
Upvotes: 0
Views: 89
Reputation: 2920
The answer above is right, but it should probably also have a private and a const..something like:
private const string str = "here";
Upvotes: 1
Reputation: 2441
Since your testStringhere()
is static, it only has access to other static members residing in the same scope.
To solve your issue in this case use
public static string mwaAHA = "here";
Upvotes: 3