How to make a global list in c#

Total Post:108


 3661  View(s)
Rate this:
I have three windows forms in my project, and I have an object class. How can I make a list of those objects that will be available for all three forms to use?
  1. Re: How to make a global list in c#

    Hi John,

    You could create a class containing an instance of your object:

    public class MyClass
        public static List<string> MyList {get; set}

    Then you can access it from your form

    MyClass.MyList = new List<string>();

    Obviously string will be replaced with the name of your object.

      Modified On Apr-04-2018 01:13:35 AM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.