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
265 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

719 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