Search code examples
c#asp.net-mvcarraysfileresult

Is it possible to get byte[] from FileResult?


Is it possible to get byte[] from FileResult in C#?


Solution

  • FileResult is an abstract class so that won't be the underlying instance type - assuming the correct overload is used then you should be able to cast it to a FileContentResult

    if (result is FileContentResult data)
    {
        var content = data.FileContents;
    }