C
C#5mo ago
ℍ𝕖𝕩

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);
}

}
}
No description
4 Replies
ThatDaniel
ThatDaniel5mo ago
Do you know the difference between static and instance?
ℍ𝕖𝕩
ℍ𝕖𝕩OP5mo ago
ohhh
ℍ𝕖𝕩
ℍ𝕖𝕩OP5mo ago
now it works
No description
ℍ𝕖𝕩
ℍ𝕖𝕩OP5mo ago
thanks
Want results from more Discord servers?
Add your server