Part 2 – C# Tutorial – Reading and writing to a console.avi

Link for code samples used in the demo

Link for csharp, asp.net, ado.net, dotnet basics, mvc and sql server video tutorial playlists

In this video, we will discuss

1. Reading from the console

2. Writing to the console

3. Two ways to write to console

a) Concatenation

b) Place holder syntax – Most preferred

Code samples used in the demo

using System;

class Program

{

static void Main()

{

// Prompt the user for his name

Console.WriteLine(“Please enter your name”);

// Read the name from console

string UserName = Console.ReadLine();

// Concatenate name with hello word and print

Console.WriteLine(“Hello ” + UserName);

//Placeholder syntax to print name with hello word

//Console.WriteLine(“Hello {0}”, UserName);

}

}

Please note that C# is case sensitive language.

The post Part 2 – C# Tutorial – Reading and writing to a console.avi appeared first on Writing Guide To Everything.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s