When you show us code, show us what you actually tried - that wont; compile for a large pile of reasons!
The most likely reason it doesn't work is that cnt is a local variable to the method in which you are calling Parallel.Invoke.
If you correct your compiler errors (and add some logging statements) it works just fine:
namespace GeneralTestingConsole
{
class SampleClass
{
static int cnt = 0;
public static void Main()
{
Parallel.Invoke(
() => method1(),
() => method2()
);
Console.WriteLine(cnt);
}
public static void method1()
{
Console.WriteLine("1:{0}", cnt);
cnt++;
Console.WriteLine("1={0}", cnt);
}
public static void method2()
{
Console.WriteLine("2:{0}", cnt);
cnt++;
Console.WriteLine("2={0}", cnt);
}
}
}
1:0
2:0
2=2
1=1
2