Why i can't insert values in private arrays?
using System.Drawing;
using System.Runtime.CompilerServices;
namespace _2_Print_the_sum_of_each_raw_from_3d_matrix
{
internal class Program
{
private static readonly Random RandomGenerator = new Random();
private List<int> ArrayOf3xMatrix = new List<int>();
static void Main(string[] args)
{
ArrayOf3xMatrix = FillMatrix(3);
}
private static List<int> FillMatrix(int size)
{
List<int> matrix = new List<int>();
for (int i = 0; i < size * size * size; i++)
{
matrix.Add(GenerateRandomNumber());
}
return matrix;
}
private static void PrintRandomMatrix(int size)
{
for (int j = 0; j < size; j++)
{
for (int i = 0; i < size; i++)
{
}
Console.WriteLine();
}
}
private static int GenerateRandomNumber()
{
return RandomGenerator.Next(0, 100);
}
}
}
using System.Drawing;
using System.Runtime.CompilerServices;
namespace _2_Print_the_sum_of_each_raw_from_3d_matrix
{
internal class Program
{
private static readonly Random RandomGenerator = new Random();
private List<int> ArrayOf3xMatrix = new List<int>();
static void Main(string[] args)
{
ArrayOf3xMatrix = FillMatrix(3);
}
private static List<int> FillMatrix(int size)
{
List<int> matrix = new List<int>();
for (int i = 0; i < size * size * size; i++)
{
matrix.Add(GenerateRandomNumber());
}
return matrix;
}
private static void PrintRandomMatrix(int size)
{
for (int j = 0; j < size; j++)
{
for (int i = 0; i < size; i++)
{
}
Console.WriteLine();
}
}
private static int GenerateRandomNumber()
{
return RandomGenerator.Next(0, 100);
}
}
}

4 Replies
Do you know the difference between static and instance?
ohhh
now it works

thanks