I want to build a data structure having a collection of array of streams. How can I make that?
Printable View
I want to build a data structure having a collection of array of streams. How can I make that?
Isnt that the same as what you asked here: http://cboard.cprogramming.com/showthread.php?t=80251 ?
Anyway you could create a class, that has a private array of Streams. Then use the indexer of that class to get to the Streams itself from outside the class.
something like:
Of course the indexer would need to do some checking on boundaries of arrays, and look at the type of objects being assigned to the array ;).Code:using System;
using System.Text;
using System.IO;
namespace GUITestC {
public class MyStreams {
private FileStream[] myStreams;
public MyStreams(int totalAmountOfStreams) {
this.myStreams = new FileStream[totalAmountOfStreams];
}
public FileStream this[int index]{
get {
return this.myStreams[index];
}
set {
this.myStreams[index] = value;
}
}
}
}