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
262 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 500 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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