Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I create an "array" of variables (e.g. Variable1, Variable2, Variable3 where the number of variables and their values is dynamic)?

Posted on 2009-04-03
3
Medium Priority
?
273 Views
Last Modified: 2013-11-07
I wanted to know how I could create a collection of MemoryStream objects where the number of individual MemoryStreams that need to exist is not known ahead of time.


MemStream1
MemStream2
MemStream4
etc.
0
Comment
Question by:endrec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
kprestage earned 2000 total points
ID: 24064033
If you are using .Net 2.0, how bout using a generic list instead?  List<System.IO.MemoryStream> x = new List<System.IO.MemoryStream>;

x.Add(New System.IO.MemoryStream());
0
 

Author Comment

by:endrec
ID: 24064114
Yes, I am using .NET 2.0.  I will try this!
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24065633
Do you have a way of knowing the number of memory streams at the point of creating the array?

you can always use redim preserve when face with a situation like that.

example:

for i=0 to count(options)
  Redim Preserve thearr(i)
  thearr(i)=MemoryStream(i)
next

done.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question