I get the following error when compiling my application:
An object refference is requied for non-static field, method or property
This is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleOpener
{
class Program
{
public static int casse;
Random rnd = new Random();
public static int openIt(int casse)
{
Int32 skin = 0;
if (casse==1)
{
skin = rnd.Next(1, 3);
}
return skin;
}
public static void Main(string[] args)
{
Console.WriteLine("Choose one of cases:");
Console.WriteLine("1. TEST CASE");
int casse = Console.Read();
openIt(casse);
}
}
}
How can I solve this? EDIT-- Please... i wouldn't write this if i find an answer. Everyone says (set something as static BUT ALMOST EVERYTHING IS NOW STATIC