c# store Array collection

is it possible to store array collection in memory and call it later in the code through another method or something.
Seven priceFull StackAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
Well you can define the Array at class level and use it anywhere in your class when you what. Is this what you are asking? If not please be more specific.
Seven priceFull StackAuthor Commented:
Well. here is the scenario.
to make my life easier for now.
I have a webmethod. submits from the client side first. Then the server side fires off from a button
OnClick="btn_submit_Click"  OnClientClick="Validate();"
so I am trying to retrieve the data hold after the client side submits and reuse it on the server as the postback starts
Fernando SotoRetiredCommented:
A disclaimerI am not a web developer.

You state this, "I have a webmethod. submits from the client side first.", this is what I get out of this. On the server you have a web method most likely part of a web service. The client on his system calls that web method. Is this correct? On what system did the Array get created on, Client or Server? Then on what system you want to store it on Client or Server?
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Seven priceFull StackAuthor Commented:
On the client side but need to hold it to pass it to the server side.
Minh Võ CôngCommented:
You can store your array to session

string[] a = new string[]{"a","b","c"};
Session["values"] = a;

you can retrieve it like this.

string[] a = (string[])Session["values"];

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seven priceFull StackAuthor Commented:
I try it. but I get
Object reference not set to an instance of an object.
Seven priceFull StackAuthor Commented:
  [WebMethod(EnableSession = true)]
        public static string SubmitInfo(ies[] iesSe)

Open in new window

here is my array that is submmited from the client side alreay. if I could hold iesSe when the serverside is running.
Remember everything is running altogether. There is no stop or pause the client side run then the server side right after.
Seven priceFull StackAuthor Commented:
thanks guys. these were great solutions. I decided to just convert it all to angularjs using a webmethod. thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.