Introduction to visual studio and c#

in #utopian-io6 years ago

previous post

How to cultivate your passion toward programming

Chapter 1

Chapter 2

Welcome steemians!

What Will We Learn?

  • We will learn the introduction to visual studio IDE (integrated development environment).

  • The concept of Object-Oriented Programming (OOP)

  • Why we will be starting with C# console application?.

  • We will also learn working on c-sharp(c#) console application

  • Lastly in this chapter we will learn how to create a simple program to display "hello, Steemians!" on c-sharp(c#) console application.

Requirements

  • A computer System is required for this tutorial.
  • Microsoft visual studio must be installed on your computer.

Get Microsoft visual studio 2012 here

Introduction to visual studio IDE

Microsoft Visual Studio is said to be an integrated development environment (IDE) from Microsoft. It can be used to develop console and graphical user interface applications along with Windows Forms applications, web sites…

The integrated development environment (IDE) of Visual Studio

visual-studio-2012-start.png

Object-Oriented Programming (OOP)

Object-oriented programming (OOP) is a programming language model organised around "objects" rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.

The first step in OOP is to identify all the objects you want to manipulate and how they relate to each other, an exercise often known as data modeling. Once you've identified an object, you generalize it as a class of objects and define the kind of data it contains and any logic sequences that can manipulate it. Each distinct logic sequence is known as a method. A real instance of a class is called an “object” or an “instance of a class”. The object or class instance is what you run in the computer. Its methods provide computer instructions and the class object characteristics provide relevant data. You communicate with objects - and they communicate with each other.

Introduction to c#

C# is an elegant and type-safe object-oriented language that enables developers to build a variety of secure and robust applications that run on the .NET Framework. You can use C# to create Windows client applications, XML Web services, distributed components, client-server applications, database applications, and much, much more..
Like I said earlier that Microsoft visual studio can be used to develop

Like I said earlier that Microsoft visual studio can be used to develop

  • Console applications
  • graphical user interface

A console application, in the context of C#, is an application that takes input and displays output at a command line console with access to three basic data streams: standard input, standard output and standard error.

A console application facilitates the reading and writing of characters from a console - either individually or as an entire line. It is the simplest form of a C# program and is typically invoked from the Windows command prompt. A console application usually exists in the form of a stand-alone executable file with minimal or no graphical user interface (GUI).
C# GUI provides an advanced code editor, convenient user interface designers, integrated debugger, and many other tools to make it easier to develop applications based on the C# language and the .NET Framework.

From my instance, the main part of a program is the coding whiles the GUI add more beauty to the proposed program.

Why we will be starting with console application?

As it has been defined; as the simplest form of a C# program that application usually exists in the form of a stand-alone executable file with minimal or no graphical user interface (GUI).let take for an instance console application is just like building a car engine without body. Which means without the car body the engine will work the body attached to it is just to beautify the car.

From my instance, the main part of a program is the coding whiles the GUI add more beauty to the proposed program.

Working on c-sharp(c#) console application

We will be starting our program with a simple program to display ‘HELLO STEEMIANS’
Hello Steemians - Our First Program

In order to create a C# console based application

  1. Open your Visual Studio

  2. On the File menu, click New Project.
    Then the New Project dialog box appears. This dialog box lists the different default application types.

  3. Select Console Application as your project type and change the name of your application at the bottom textbox.
    If you are not comfortable with default location, you can always enter a new path if you want.

  4. Then Click OK.

After click OK button, you will get a screen like the following picture.

console.png

we study basic building blocks of the C# programming language, let us look at a bare minimum C# program structure so that we can take it as a reference.

A C# program consists of the following parts:

  • Namespace declaration

  • A class

  • Class methods

  • Class attributes

  • A Main method

  • Statements and Expressions

  • Comments

Code that prints the words "Hello Steemians":

using System;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, Steemians!");
Console.Readkey();

    }
}

}

After you enter the command, the next step is to run the program. You can run your program using Ctrl+F5 or by clicking the play icon on the tool bar. Then Visual Studio will keep the console window open, until you press a key. You will get screen look like the following picture.

output.png

Looking at the various parts of the given program:

  • The first line of the program using System;-the using keyword is used to include the system namespace in the program. A program generally has multiple using statements.

  • The next line has the namespace declaration. A namespace is a collection of classes. The Hellosteemians Application namespace contains the class Hello Steemians.

  • The next line has a class declaration, the class HelloSteemians contains the data and method definitions that your program uses. Classes generally contain multiple methods. Methods define the behavior of the class. However, the HelloSteemians class has only one method Main.

  • The next line defines the Main method, which is the entry point for all C# programs. The Main method states what the class does when executed.

  • The next line /.../ is ignored by the compiler and it is put to add comments in the program.

  • The Main method specifies its behavior with the statement Console.WriteLine("Hello, Steemians!");

  • WriteLine is a method of the Console class defined in the system namespace. This statement causes the message "Hello, Steemians!" to be displayed on the screen.

  • The last line Console.ReadKey();is for the VS.NET Users. This makes the program wait for a key press and it prevents the screen from running and closing quickly when the program is launched from Visual Studio .NET.

Thanks for your time

Sort:  

Interesting Good Luck

Well I’m going to have to learn. Interesting to know. Thank you.

You are welcome.

Good work. It is very helpful.
Also visit the following link
https://steemit.com/music/@dhitalajay/passage-the-power-of-music

Nice lecture from the brain-box @branx
Really enjoyed seeing this. However, if i may contrubute to this...

How about you use code block for your line of codes in order to make the codes more readable. To use it, just enclose your code in this (~~~ codes here ~~~)
Let me make a sample...

import javax.swing.JOptionPane;

public class Hello {
public static void main (String []args) {
    JOptionPane.showMessageDialog (null,  "hello steemit");

  }
}

This is just a simple Java program, the point here is how the code shows to the readers.

I believe this makes this lines of code more readable and Utopian-io moderator wouldn't reject your post for this reason.

Thanks for the suggestion @teekingtv.

Coin Marketplace

STEEM 0.28
TRX 0.12
JST 0.032
BTC 66739.81
ETH 3087.19
USDT 1.00
SBD 3.73