无法将string []转换为byte []

Mic*_*ard 0 c# directory byte converter

我在做什么是这样的:

ArrayList files = new ArrayList();
byte[] tempFile;
string image;

foreach (string file in files)
{
    image = "/Images/Gallery/" + album.Substring(94) + "/" + file;

    tempFile = Directory.GetFiles(image);
}
Run Code Online (Sandbox Code Playgroud)

我无法将字符串[] Directory.GetFiles(image)转换为byte [] tempFile.如何才能做到这一点?

Kim*_*mCM 7

请试试这个:

...

{
    image = Path.Combine("Images", "Gallery", album.Substring(94), file);
    tempFile = File.ReadAllBytes(image);
}
Run Code Online (Sandbox Code Playgroud)