This book covers C# programming with a practical approach.The author assumes you have no experience in programming. The book starts with the installation of the required programming environment. Then, the simplest "Hello World" program is developed step by step. In the next three chapters (Chapters 4 to 6), Windows forms (the visual part of desktop programs) and their components are studied with practical examples. Screenshots and code snippets are clearly given in the book to guide the reader. After teaching the graphical user interface (GUI) design, C# programming is covered in an organized manner in the following eight chapters (Chapters 7 to 14) with dozens of example projects. As the reader follows the development of the sample projects, he/she will learn designing user interfaces, connecting interface objects to code, developing efficient C# code and generating standalone programs. Connecting to Access databases from our C# programs for permanent data storage is explained in Chapter 15. In the last Chapter, the basics of Unity game engine are given and a simple 2D platform game is developed in Unity using C#.Chapters of the book and the contents of these chapters are as follows: Chapter 1. Introduction: General info on C# and .NET environment. Chapter 2. Setting up your development environment: Installing and configuring Visual Studio. Chapter 3. Test drive - the "Hello World" project: Creating a new Visual C# project, adding and positioning a Label and building the project. Chapter 4. Form (GUI) elements: Containers, menus, dialog windows, components, controls, properties and events of controls. Chapter 5. Common controls: Using common controls like Buttons, TextBoxes and ProgressBars in our projects (a total of 21 commonly used controls are studied). Chapter 6. Menus, dialogs and containers: Utilizing various menu types, using dialog windows to take user input, file open/save operations and incorporating containers to organize the form layout. Chapter 7. Variables and constants: Organized C# programming begins in this chapter. Declaring variables, variable types, type conversions and constants. Chapter 8. Conditional statements: Operators, various types of if-else structures and switch-case statements. Chapter 9. Loops: The need for loops in our programs. Utilization of for, foreach, while and do-while loops. Break and continue statements. Chapter 10. Arrays and collections: Declaring arrays, using multidimensional arrays and array operations. Hashtable and ArrayList structures for storing multiple types of variables together. Chapter 11. Methods: Method declarations, scopes of methods, passing variables by value and by reference. Chapter 12. Classes and objects: The class-object concept. Declaring and using classes. Creating objects. Utilizing several constructor methods for flexibility. Chapter 13. Frequently used classes in C#: Utilizing the methods of the String class, the StringBuilder class and the Math class. Chapter 14. Handling Errors: Preventing our programs from crashes in case of errors. Try-catch, try-catch-finally structures and the throw keyword. Chapter 15. Database connections using ADO.NET: Creating Access databases from scratch, reading and modifying database entries from our C# programs. Chapter 16. Developing a 2D game in Unity using C#: Installing the Unity game engine. Using C# in Unity to develop our own 2D platform game called Random Platformer. Exporting the game as a standalone program. This book includes 507 figures and 309 code snippets that are used to explain C# programming and GUI development concepts clearly. Full resolution colour figures and complete project files can be downloaded from the book's companion website: www.yamaclis.com/csharp.
Author: Serhan Yamacli