Hai friend today I am going to say about Multithreaded
Programming Using C#
In .net Multithreaded stands for executing the code parallel
when we take two methods and execute the
code is executed sequential manner the code first method and then come to
second method .if u want to code execute parallely we go for Multithreaded
concept
Program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[]
args)
{
Thread
obj1 = new Thread(data1);
Thread
obj2 = new Thread(data2);
obj1.Start();
obj2.Start();
}
public static void data1()
{
for
(int i = 0; i <= 10; i++)
{
Console.WriteLine("this is my data" + i.ToString());
}
}
public static void data2()
{
for
(int i = 0; i <= 10; i++)
{
Console.WriteLine("this is my newdata" + i.ToString());
}
Console.ReadLine();
}
}
}
Output:
0 comments:
Post a Comment