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.
LVL 9
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.
0
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
0
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?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Seven priceFull StackAuthor Commented:
On the client side but need to hold it to pass it to the server side.
0
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"];
0

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.
0
Seven priceFull StackAuthor Commented:
  [WebMethod(EnableSession = true)]
        [ScriptMethod]
        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.
0
Seven priceFull StackAuthor Commented:
thanks guys. these were great solutions. I decided to just convert it all to angularjs using a webmethod. thanks again.
0
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
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.