Tasks in action

A quick reference on how you can use tasks. I wont write much around here as the code is explaining it self. The name of the methods tell the action around the task, how they were created and what is the purpose of that code. This is really basic code snippet right now but i will write more around that and more detailed code

Snippet

class Program
	{
		static void Main(string[] args)
		{
			Console.WriteLine("Passing parameters to task");
			passingParametersToTask();
			Console.WriteLine("Starting task with action");
			startingATaskWithAction();
			Console.WriteLine("Starting task with run");
			startingATaskWithRun();
			Console.WriteLine("Canceling the task");
			taskWithCancelationToken();
			
			
		}
 
		private static void passingParametersToTask()
		{
			var counter = 3;
			Task t = new Task((c) =>
			{
				for (var i = 1; i <= (int)c; i++)
				{
					Console.WriteLine("parameter number = " + i);
					Thread.Sleep(1000);
				}
			}, counter);
			t.Start();
			t.Wait();
		}
 
		private static void taskWithCancelationToken()
		{
			var tokenSource = new CancellationTokenSource();
			var token = tokenSource.Token;
			Task t = new Task(() =>
			{
				for (var i = 0; i < 2; i++)
				{
					Console.WriteLine("i = " + i);
					if(token.IsCancellationRequested)
						token.ThrowIfCancellationRequested();
					Thread.Sleep(1000);
				}
			});
			t.Start();
			tokenSource.Cancel();
			try
			{
				t.Wait();
			}
			catch (AggregateException e)
			{
				Console.WriteLine("Task Canceled");
			}
		}
 
		private static void startingATaskWithRun()
		{
			Task t = Task.Run(() =>
			{
				for (var i = 0; i < 2; i++)
				{
					Console.WriteLine("Started With Run Stage " + i);
					Thread.Sleep(1000);
				}
			});
			t.Wait();
		}
 
		private static void startingATaskWithAction()
		{
			Task t = new Task(() =>
			{
				for (var i = 0; i < 2; i++)
				{
					Console.WriteLine("Started With action Stage " + i);
					Thread.Sleep(1000);
				}
			});
			t.Start();
			t.Wait();
 
		}
	}