public void CopyFile(string sourcepath, string destpath)
{
using (FileStream fs = new FileStream(sourcepath, FileMode.Open, FileAccess.Read))
{
using (FileStream fs2 = new FileStream(destpath, FileMode.Create, FileAccess.Write))
{
byte[] b = new byte[1024];
int l = 0;
while ((l = fs.Read(b, 0, b.Length)) > 0)
{
fs2.Write(b, 0, l);
}
}
}
}
{
using (FileStream fs = new FileStream(sourcepath, FileMode.Open, FileAccess.Read))
{
using (FileStream fs2 = new FileStream(destpath, FileMode.Create, FileAccess.Write))
{
byte[] b = new byte[1024];
int l = 0;
while ((l = fs.Read(b, 0, b.Length)) > 0)
{
fs2.Write(b, 0, l);
}
}
}
}