Can you please tell me how to store an array in session and how to retrieve that array from session?
I am trying to store one array of type Double
and assigning values of the same type but it is showing me an error. How do I assign values to the array which is in session?
I am using ASP.NET MVC.
Session["your_array"] = new double[]{1.0,2.0,3.0};
double[] arr = double[](Session["your_array"]);
You have probably worked out how to get the double array in, but may be having some trouble getting them back out - so here are examples of both:
double[] myDoubleArray = new double[] { 1.0, 1.2, 1.3, 1.4};
Session["DoubleList"] = myDoubleArray;
double[] sessionDoubles = (double[])Session["DoubleList"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With