C# : .NET

[".0s4*0|collections;datetime-format;collections",["F@eA","GAMAOGHCJC","OOOCBSTUUUUTTUUUUYGDGDHDGDGDFOBWCBSTTUUUUTTUUUU","ewt.",".NET","Array","Dictionary","List","String","2D","Async","Console","DataTable","Dates","DateTime","Enum","File","For","Foreach","Format","IEnumerable","If","IndexOf","Lambda","LINQ","Optimization","Parse","Path","Process","Property","Random","Regex","Replace","Sort","Split","Static","Substring","Switch","Tuple","While","ThreadStart"," specifies a target method. It does not support any arguments to the method. We use the ThreadStart type. We create an instance of it and pass that to the Thread constructor.","This example"," C# program creates an array of four different threads. It starts a parameterless method on each thread. It then joins the threads together in a sequential order.","Next,"," we see that ThreadStart is created with a constructor that receives a function name as its only argument: the target method. This target method must not receive any formal parameters. ","Then: ","The ThreadStart instance is passed as an argument to the Thread constructor.","Constructor ","constructor","ins","class","adsbygoogle","data-ad-client","ca-pub-4712093147740724","data-ad-slot","6227126509","data-ad-format","auto","br","ins","class","adsbygoogle","data-ad-client","ca-pub-4712093147740724","data-ad-slot","6227126509","data-ad-format","auto","C# program that uses ThreadStart","\n\nusing System;\nusing System.Threading;\n\nclass Program\n{\n static void Main()\n {","\n // Create an array of Thread references.\n ","Thread[] array = new Thread[4];\n for (int i = 0; i < array.Length; i++)\n {","\n // Start the thread with a ThreadStart.\n ","ThreadStart start = new ","ThreadStart","(Start);\n array[i] = new Thread(start);\n array[i].Start();\n }","\n // Join all the threads.\n ","for (int i = 0; i < array.Length; i++)\n {\n array[i].Join();\n }\n Console.WriteLine(\"DONE\");\n }\n\n static void Start()\n {","\n // This method has no formal parameters.\n ","Console.WriteLine(\"Start()\");\n }\n}\n\n","Output","\n\nStart()\nStart()\nStart()\nStart()\nDONE","Discussion."," Using this same general example, we explain the Join method in more detail, also on this site. Please visit the appropriate article for a more thorough explanation of the Join method on the Thread type in the C# language. ","Thread Join Method ","thread-join","Summary."," The ThreadStart type enables you to start a thread and pass no arguments to the target method. For parameterless target methods, this type is ideal, and you should pass it to the Thread constructor. ","Tip: ","For more detailed information on threading in the C# language and .NET Framework, check out the thread category on this site.","ParameterizedThreadStart ","parameterizedthreadstart","br","ins","class","adsbygoogle","data-ad-client","ca-pub-4712093147740724","data-ad-slot","3679700504","data-ad-format","link","br","ins","class","adsbygoogle","data-ad-client","ca-pub-4712093147740724","data-ad-slot","6227126509","data-ad-format","auto"],"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAABZCAMAAAD1qB0CAAAAGFBMVEX///+vr6/Nzc1kZGSNjY3k5OQxMTEAAABgpIToAAADeUlEQVR4Xu1Z23YcIQxbX/n/P273lMYJRSilM4d5qB5DwAIJe7y8NqEi+noeIttPpD6S1xvyMGLZOvKGACqyu19pHTccmfwyyR41L2JGJuwunbEz224jVlv2bWJ4/j4USHGlx454JO66la3g/3Ytr82w0ZAU0hGUWc2+x2ItpolTuZpu5pT/vndzfpSvM3BkMakbcQSGlPTDpTmBksRi9wMoedxiAZQ8bjFFSnqd4xFIKTm3mBwnFnPvxek0ZnOJ83U6jcmOxRTUUj5JKbFBMu34Tdi18JVBSJ8LG7cQz7cW8ir0SfVnhEFJbQv4JABMwlEUmkU1Fx20Ex2UlIZR4SsAcqJWCa5th8Gt4jQWpSxEjLNg42azcUEiYGJ1J62jdaQV/EuOMTMcoI2wfp1cVFWMtwkyH4/1PJEYhLdBBxsJhH2OolkDa2KAL0uvNicWU0ktZh2MLVd21AKzukG8IlDtsqmuiAk4Cf8uMVlZGIfAMfogTCKXERM8tCDmaBIpHNSLupB6qaXOhwRuBnqR98K4SkNiiebYdxsGZ8TIdw2Y6JsW4140EhsO+lTJwALggsZPFLsf6JxcAKJUsk5Htog5UB9YjKY7fqKcWAlGBCAWo5d2h1hyAbjF+IlyYuOY86zJLcZPFBNLsLL+lQC8YeEFhKcLGcNzAXhPzG83/zLxCr+RXoNITgqIL+LYoOReBc+9gmWLOLUqEGDfYryAkGzhWIB7LRYL74eZ6WUW4+mVe5/Hu99izvZ1v8UE0y4lOfwKi/GC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