Since File.Create
returns the stream i would dispose it properly:
using(var stream = File.Create(newPath)){}
File.WriteAllBytes(newPath, item.File);
or you can use the stream to write to the file directly:
using (FileStream fs = File.Create(newPath))
{
fs.Write(item.File, 0, item.File.Length);
}
or, probably the easiest, use File.WriteAllBytes
alone:
File.WriteAllBytes(newPath, item.File);
Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.