Question : dynamic array as application variable?

Can I create an application-scoped array and then dynamically write and delete elements from pages in my application?

Answer : dynamic array as application variable?


No. It shows you can access the array (add or delete elements) from any other page...may be a List<> variable will picture it better as shown below:

public class Global : System.Web.HttpApplication
{
      public static List<int> Ids = new List<int>();
....
}

in Page 1
public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Global.Ids.Add(100);
        }
....

in Page 2
public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Global.Ids.Remove(100);
        }
....


Random Solutions  
 
programming4us programming4us