Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

C# Reference variable from Main method in another method

$
0
0

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



Viewing all articles
Browse latest Browse all 24688


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>