Класс Masif - исключение NullReferenceException - C#
Формулировка задачи:
Есть класс Масив:
На рядку, выделенному звёздочками выдаёт ошибку:
"Необработанное исключение типа "System.NullReferenceException" в LR1.exe
Дополнительные сведения: Ссылка на объект не указывает на экземпляр объекта. "
Что делать? Помогите
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LR1
{
public class Masif
{
public int n = 3, m = 3;
Int64[,] Drray;
public void Inp()//int n, int m, double[,] Drray)
{
int i = 0, j = 0;
while (i < n)
{
while (j < m)
{
Console.WriteLine("Vvedit DArray[" + i + "][" + j + "]: ");
Drray[i, j] = Console.Read();
*** j=j+1; ***
}
i++;
}
}
public Masif(int a, int b)
{
n = a;
m = b;
}
public Masif()
{
}
}
}Решение задачи: «Класс Masif - исключение NullReferenceException»
textual
Листинг программы
public class Masif
{
public int n, m;
Int64[,] Drray;
public void Inp()//int n, int m, double[,] Drray)
{
int i = 0, j = 0;
while (i < n)
{
while (j < m)
{
Console.WriteLine("Vvedit DArray[" + i + "][" + j + "]: ");
Drray[i, j] = Console.Read();
*** j=j+1; ***
}
i++;
}
}
public Masif(int a, int b)
{
n = a;
m = b;
Drray = new int[n,m];
}
public Masif()
: this(3,3)
{
}
}