the Main method is static

If you’re new to C# programming (or .NET in general, perhaps) you may run across this kind of error making your first console application:

21:02 [ mikdeazy] hey im using amib.threading to create a threadpool but it won’t let me use the “this” keyword in the main of the console app, how can i get around this ?
21:04 [ mikdeazy] it says keyword this is not valid in a static property method or field etc,..
21:10 [ Flav] the Main method is static (not associated with any instance of the class), so either change the thing you’re trying to access to also be static or create and invoke an instance instead

Advertisements