"An object reference is required for the non-static field, method, or property 'Test.Program.t'"
I am getting errors like that in the Main method of my test class.
There is the code, Bolded characters are the problems.Code:public class Program { double time = 1; //second int t = 100; int i = 10; int j = 10; static void Main(string[] args) { Temperatures temps = new Temperatures(time, t, i, j); if (temps.stability()<=0.5) Console.WriteLine("Stability = "+temps.stability()+ " < 0.5"); else Console.WriteLine("UNSTABLE!!! Stability = " +temps.stability()); Console.WriteLine("dx = "+temps.dx()+" m"); Console.WriteLine("dy = "+temps.dy()+" m"); Console.WriteLine("dt = "+temps.dt()+" s"); Console.WriteLine("LambdaX = "+ temps.lX()); Console.WriteLine("LambdaY = "+ temps.lY()); Console.WriteLine(" "); // Console.WriteLine("Bottom-Left corner = "+temps.profile()[t,i,j]+" C."); // Console.WriteLine("Center-point = "+temps.profile()[t,i/2,j/2]+" C."); for (int l = 0; l<=t; l++) { for (int m = 0; m<=i; m++) { for (int n = 0; n<=j; n++) { Console.WriteLine(temps.profile()[l,m,n]); } } } } }




Reply With Quote