Hi, I am trying to reference a variable from Main method in a different method and I am not sure how to do this. Could you please help me out.
using System.IO; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { public void Main() { var game = "game 10"; var score = "25"; } public class result { var gamenumber = Main.game; //access the variable game from main method var scorecard = Main.score; //access the variable score from main method } }
Thanks in advance.
SQLEnthusiast