Book Image

Learn C# in 7 days

By : Gaurav Aroraa
1 (1)
Book Image

Learn C# in 7 days

1 (1)
By: Gaurav Aroraa

Overview of this book

This book takes a unique approach to teach C# to absolute beginners. You’ll learn the basics of the language in seven days. It takes a practical approach to explain the important concepts that build the foundation of the C# programming language. The book begins by teaching you the basic fundamentals using real-world practical examples and gets you acquainted with C# programming. We cover some important features and nuances of the language in a hands-on way, helping you grasp the concepts in a fluid manner. Later, you’ll explore the concepts of Object-Oriented Programming (OOP) through a real-world example. Then we dive into advanced-level concepts such as generics and collections, and you’ll get acquainted with objects and LINQ. Towards the end, you’ll build an application that covers all the concepts explained in the book. By the end of this book, you will have next-level skills and a good knowledge of the fundamentals of C#.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Leveraging preprocessor directives


As is clear from the name, preprocessor directives are the processes undertaken before the actual compilation starts. In other words, these preprocessors give instructions to the compiler to preprocess the information, and this works before the compiler compiles the code.

Important points

There are the following points to note for preprocessors while you're working with them:

  • Preprocessor directives are actually conditions for the compiler
  • Preprocessor directives must start with the # symbol
  • Preprocessor directives should not be terminated with a semi colon (;) like a statement terminates
  • Preprocessors are not used to create macros
  • Preprocessors should be declared line by line

Preprocessor directives in action

Consider the following preprocessor directive:

#if ... #endif  

This directive is a conditional directive, code executes whenever this directive is applied to the code, you can also use #elseif and/or #else directives. As this is a conditional directive and...