E.g.
vb.net Code:
  1. Private Sub CopyFile(ByVal sourcePath As String, _
  2.                      ByVal destinationPath As String, _
  3.                      ByVal blockSize As Integer)
  4.     Using source As New IO.FileStream(sourcePath, IO.FileMode.Open)
  5.         Using destination As New IO.FileStream(destinationPath, IO.FileMode.Create)
  6.             Dim buffer(blockSize - 1) As Byte
  7.             Dim byteCount As Integer = source.Read(buffer, 0, blockSize)
  8.  
  9.             While byteCount > 0
  10.                 destination.Write(buffer, 0, byteCount)
  11.                 byteCount = source.Read(buffer, 0, blockSize)
  12.             End While
  13.         End Using
  14.     End Using
  15. End Sub