Menu
CoddyTech

Hello, .NET

Part of the C# and .NET Basics section of Coddy's ASP.NET Core journey. Lesson 1 of 20.

.NET is the platform C# runs on. It has two parts: the runtime, which runs compiled programs, and the SDK, the tools that build them. On your own computer, dotnet new console makes a project and dotnet run builds and runs it. A project file, .csproj, tells the SDK what to build. Here Coddy keeps that file for you.

A modern C# program needs no class and no Main method. The lines at the top of Program.cs are top-level statements, and they run in order:

Console.WriteLine("Weather Station");
Console.WriteLine("Sunny, 24 degrees");

Each Console.WriteLine prints one line. Press Run to build the program and see what it prints.

challenge icon

Challenge

Beginner

In this section you build an expense tracker you run from the command line. It starts with its title and how many expenses it holds.

  1. In Program.cs, replace the line that prints Hello, .NET!.
  2. The program must print exactly these two lines, in this order, and nothing else:
    Expense Tracker
    0 expenses
    Expense Tracker has a capital E and a capital T. 0 expenses is all lowercase.

Try it: press Run. The output shows the two lines above, with nothing before them.

Try it yourself

Console.WriteLine("Hello, .NET!");

All lessons in C# and .NET Basics