Basically I'm making a hangman game in C# but the problem is whenever I try to turn my string word to char[] with word.ToCharArray(); it does not work.
Can someone figure out what is wrong with this code?
List<string> words = new List<string>();
List<string> guessedLetters = new List<string>();
string word = "sword";
// Turning word into char array
char[] letters = word.ToCharArray();
CS0236 A field initializer cannot reference the non-static field, method, or property 'Form1.word' final C:\Users*\Desktop\final\final\Form1.cs 20 Active
lettersin the constructor, or define a proper method for your code.