An example that uses Parallel.ForEach loop to ping a given array of website urls.
static void Main()
{
string [] urls =
{
"www.stackoverflow.com",
"www.google.net",
"www.facebook.com",
"www.twitter.com"
...
An example that uses Parallel.For loop to ping a given array of website urls.
static void Main()
{
string [] urls =
{
"www.stackoverflow.com",
"www.google.net",
"www.facebook.com",
"www.twitter.com"
};
...
public class Foo
{
private const int TASK_ITERATION_DELAY_MS = 1000;
private CancellationTokenSource _cts;
public Foo()
{
this._cts = new CancellationTokenSource();
}
public void StartExecution()
{
Task.Factory.StartNew(this.OwnCodeCancelable...
public class Foo
{
private CancellationTokenSource _cts;
public Foo()
{
this._cts = new CancellationTokenSource();
}
public void StartExecution()
{
Task.Factory.StartNew(this.OwnCodeCancelableTask, this._cts.Token);
}
public void Cance...