This is my 1st day at this amazing forum .
Here comes one of my doubt . well NEW key is used to create an Object of non-static members RIGHT . Actually problem is in multi-threading NEW keyword is used under a non-static block of a constructor to create new thread like t1 = new thread(method_name) .
So plz Clarify me what's going on here . Hope everything clarifies my doubt :)
Thanks in advance

VulpesPosted Feb 6, 2013, 1:42 PM
The output should be:
SUNIL GUTTAPosted Feb 6, 2013, 9:39 PM
Any ways for further doubts will revert back at you :)
SUNIL GUTTAPosted Feb 6, 2013, 12:05 PM
By default main method is static method right . we always used to create object of members under Main right :) so basic rule in Object creation is Object can only be created under Static block like Main,any static method or etc that is must !
As obj can created only using NEW key . that fallowed my doubt :)
I hope you got it
Thank you
VulpesPosted Feb 6, 2013, 6:01 AM
What led you to think that it couldn't be used in a non-static block?
SUNIL GUTTAPosted Feb 5, 2013, 9:30 PM
I just want explanation on NEW keyword just NEW keyword used in thread creation under instance constructor like u said .
I am thinking NEW keyword is used only under static block of code for creating objects or threads etc .. can NEW key used under non-static blocks ?? like above you mentioned under instance constructor ?
Ex:public A()
Thank you
VulpesPosted Feb 5, 2013, 2:06 PM
For example, this compiles and runs fine:
SUNIL GUTTAPosted Feb 5, 2013, 1:19 PM
Thanks for the quick reply but my doubt here is regarding NEW keyword that used to create a thread under non-static constructor.
PS:In C# rules we cant create a obj or etc using NEW keyword under non-static block of code i.e constructor .
Thank you
VulpesPosted Feb 5, 2013, 6:04 AM
Thread t1 = new Thread(new ThreadStart(method_name));
The Thread class's constructor needs to be passed a ThreadStart delegate which tells it what method to execute when the thread starts.
So when you do this:
Thread t1 = new Thread(method_name);
the C# compiler automatically creates a ThreadStart delegate based on method_name and passes that to Thread's constructor.