Выдает исключение, в чем ошибка? - C#
Формулировка задачи:
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
string s = @"C:\Users\Виктор\Desktop\ТЗ!!!\RPT\3.rpt";
ReadFile read = new ReadFile(s);
read.reWrite();
}
}
class ReadFile
{
public static string pathToFile;
public ReadFile(string str)
{
pathToFile = str;
}
public static byte[] byteArray = File.ReadAllBytes(pathToFile);
public void reWrite()
{
Console.WriteLine("{0}", byteArray[4]);
}
}
}Решение задачи: «Выдает исключение, в чем ошибка?»
textual
Листинг программы
for (int i = 0; i < r.byteArray.Lenght; i++)
{
Console.WriteLine(r.byteArray[i]);
}