Chapter 2. Dive into C#: Statements, Classes, and Code


You’re not just an IDE user. You’re a developer.

You can get a lot of work done using the IDE, but there’s only so far it can take you. Visual Studio is one of the most advanced software development tools ever made, but a powerful IDE is only the beginning. It’s time to dig in to C# code: how it’s structured, how it works, and how you can take control of it…because there’s no limit to what you can get your apps to do.

(And for the record, you can be a real developer no matter what kind of keyboard you prefer. The only thing you need to do is write code!)

Let’s take a closer look at the files for a console app

In the last chapter, you created a new .NET Core Console App project and named it MyFirstConsoleApp. When you did that, Visual Studio created two folders and three files.


Let’s take a closer look at the Program.cs file that it created. Open it up in Visual Studio:

  • At the top of the file is a using directive. You’ll see using lines like this in all of your C# code files.

  • Right after the using directives comes the namespace keyword. Your code is in a namespace called MyFirstConsoleApp. Right after it is an opening ...

Get Head First C#, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.