Home How to pass list array from Main class to A second class inside the same file?
Reply: 0

How to pass list array from Main class to A second class inside the same file?

user668
1#
user668 Published in April 25, 2018, 12:42 am

So below I have two classes Program which is the main class and testing which is the second class. How can I pass the content of List<String> list = new List<String>(); into the List<String> newList = new List<String>(); within the second class.

    class Program
    {
        static void Main(string[] args)
        {
          List<String> list = new List<String>();
          list.Add("Test1");

          testing client = new testing();

        } 
    }

    public class testing
    {
       List<String> newList = new List<String>();

    } 
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298909 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO