Chapter 2 Writing a First Program

What’s in This Chapter

  • Solutions and projects
  • Creating console, Windows Forms, WPF, and Windows Store applications
  • Naming conventions
  • How the CLR starts programs

Wrox.com Downloads for This Chapter

Please note that all the code examples for this chapter are available as a part of this chapter’s code download on the book’s website at www.wrox.com/go/csharp5programmersref on the Download Code tab.

Unless you plan to edit C# files in a text editor and then use the command-line interface to compile them, you will probably end up using Visual Studio to write and build C# programs. Because of that, this book does cover Visual Studio to some extent.

The book’s goal, however, is to cover the C# language. This chapter explains the most common kinds of applications that you can build in C#. It shows how you can build programs that provide buttons or other methods for executing your C# code.

Visual Studio enables you to build many different kinds of applications. This chapter explains how to start with four of those types: console, Windows Forms, WPF, and Windows Store applications.

Types of Projects

A Visual Studio solution contains the files that you need to create some sort of result. Typically, the result is a single executable application; although, it could be a suite of related applications together with documentation and other related items.

The solution is defined by two files with .sln and .suo extensions. The .sln file stores information ...

Get C# 5.0 Programmer's Reference now with O’Reilly online learning.

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