-1

I have written this function:

    public static Mp3FileReader GetSoundsFromFiles(byte[] bytes)
    {
        return new Mp3FileReader(new MemoryStream(bytes));
    }

And I need to parse some byte arrays with keyword "params" instead of one. Can anyone help me?

SOCIOPATH
  • 72
  • 7
  • Can you explain a bit more. You want your `GetSoundsFromFiles` method to get multiple `byte[]`s and concatenate them into one big `byte[]` and create a memory stream of it? – Emad Mar 28 '17 at 05:16
  • @Emad, I need to create an array of byte[] arrays and create MemoryStream from each array – SOCIOPATH Mar 28 '17 at 05:17
  • if you are going to read MP3, this might be helpful: byte[] byteData = System.IO.File.ReadAllBytes(fileName); – Md. Tazbir Ur Rahman Bhuiyan Mar 28 '17 at 05:20

1 Answers1

2

Maybe using a list of byte arrays would do the trick for you, like this:

public static List<Mp3FileReader> GetSoundsFromFiles(List<byte[]> bytes)
{
    List<Mp3FileReader> soundList=new List<Mp3FileReader>();
    foreach (var a in bytes)
    {
        soundList.Add(new Mp3FileReader(new MemoryStream (a));
    }
    return soundList;
}
tadej
  • 701
  • 1
  • 5
  • 22