I am creating a really basic program, that has a method to fill an array but I am getting an error I don't understand. I am a Java programmer trying to acclimate to C# and .NET. Any help would be great.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading;
namespace TestThreads
{
class Program
{
static void Main(string[] args)
{
int[] empty = new int[50001];
int[] filled = new int[50001];
filled = compute(empty); //error occurs here
Console.ReadLine();
}
public int[] compute(int[] inArray)
{
for (int i = 0; i < inArray.Length; i++)
{
inArray[i] = i << 2;
}
return inArray;
}
}
}
Error Message:
Error 1 An object reference is required for the non-static field, method, or property 'TestThreads.Program.compute(int[])' C:\Users\hunter.mcmillen\Desktop\TestProcessSplitting\TestProcessSplitting\Program.cs 17 22 TestThreads
Thanks, Hunter