MCQs > IT & Programming > C# > 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();     } }>

C# MCQs

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();

    }

}

Answer

Correct Answer: 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.

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it