Giter Site home page Giter Site logo

csharp_intro's Introduction

CSHARP_INTRO

Your first console application

Not Hello, World

Getting Started Guide

Please read and complete the steps in the official Get Started with C# and Visual Studio Code guide.

Your first console application

Let's begin with your first C# console application (also known as a "command line interface" application or "cli" app).

Create a directory to hold the application.

mkdir -p ~/workspace/csharp/Intro && cd $_

Create a new console application with the dotnet command line utility.

dotnet new console

This will create two files in the directory

  1. intro.csproj - This file holds all the packages that you application will be using. It's the package.json for C#.
  2. Program.cs - This is the file that holds your logic. Think of it as your main.js. It's where the logic of your application starts.

Copy this code into your Program.cs, replacing everything there.

using System;

namespace Intro
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.Write("What is your name? ");
            string name = Console.ReadLine();
            Console.WriteLine($"Hello, {name}! I'm glad to meet you.");
        }
    }
}

Run the program.

dotnet run

Enter a name and marvel at the warm greeting you receive.

What else would you like app to say? Take a few minutes and play with this code. What deep, philosophical truths can you make this app reveal?

Learning a Second Language

Learning your first programming language is hard. It's hard because you're learning more than syntax, you're learning how to code at the same time.

I have some good news. When it comes to learning your second language, you can transfer much of your understanding of your first language. It turns out that much of what you learned in JavaScript will apply to C# as well. There are notable differences and C# has some new concepts to learn, but a lot of the basic building blocks are the same.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.