Question:What is the problem with the following function, which is supposed to convert a Stream into byte array?
public static byte[] ReadFully(Stream input)
{
    using (MemoryStream ms = new MemoryStream())
    {
        input.CopyTo(ms);
        return ms.ToArray();
    }
}
 

A It will work only in .NET Framework 4 or above, as the CopyTo function of the memory stream is available only in .NET Framework 4 or later versions. 

B It will work only in .NET Framework 3.5 or below, as the CopyTo function of the memory stream is available only in .NET Framework 3.5 or earlier versions. 

C It will work in all versions of the .NET framework. 

D None of these. 

+ Answer
+ Report
Total Preview: 1187

Copyright © 2024. Powered by Intellect Software Ltd