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

Preface

Learning a new language or switching to an entirely different technology is a common industry demand. As a student one should prepare oneself to be up to date with market trends, and as a professional, one should be aware of the new things that are coming in with new technologies. To meet this demand, there are a lot of books that are of thousand pages long and aim to be comprehensive references to the C# programming language. This book is entirely different and written so that someone who has a very basic knowledge of the C# language, or is a professional and working with another language but wants to switch, can learn C#. This book was designed with the aim that one should start with the basics and progress to an advanced level. The book contains concise content with relevant examples to explain everything. There are a lot of sections in the book that will encourage you to learn more ; with this knowledge, you can impress your colleagues, employers, or batch-mates. There will be a few terms you will hear first time – no problem, you can learn about them in this book. At the end of every section you will find a hands-on exercise section that will build confidence and give you ideas for solving practical problems. You can find various hints in these exercises. For the code examples, you can go to the GitHub repository (https://github.com/PacktPublishing/Learn-CSharp-in-7-days/) and download the source code for all chapters. You can easily use these code example in Visual Studio 2017 Update 3 by following the instructions mentioned thereon.

What this book covers

Chapter 1, Day 01 - Overview of the .NET Framework, gets you familiar with C#, including .NET Framework and .NET Core.

Chapter 2Day 02 - Getting Started with C#, gives you a basic understanding of C# by iterating through the type system and the use of various constructs. The use and importance of reserved keywords, understanding statements, type conversions.

Chapter 3, Day 03 - What's New in C#, gets you familiar with various new important features introduced in versions 7.0 and 7.1.

Chapter 4Day 04 - Discussing C# Class Members, explains the fundamentals of class and its members will be explained including indexers, the filesystem, exception handling, and string manipulation with regular expressions.

Chapter 5, Day 05 - Overview of Reflection and Collections, covers working with code using reflection, and an introduction to collections, delegates, and events.

Chapter 6, Day 06 - Deep Dive with Advanced Concepts, teaches you about implementing attributes, using preprocessors, and understanding generics and their usage, including sync and async programming.

Chapter 7, Day 07 - Understanding Object-Oriented Programming withC#, In this chapter we will learn all 4-paradigm of oop and implement using C# 7.0.

Chapter 8, Day 08 - Test Your Skills – Build a Real-World Application, helps you to write a complete application with the help of what you learned from this book.

What you need for this book

All supporting code samples in this book have been tested on .NET Core 2.0 using Visual Studio 2017 update 3, database using SQL Server 2008R2 or later on the Windows platform.

Who this book is for

Learn C# in 7 Days is a fast-paced guide. In this book, we take a unique approach to teaching C# to an absolute beginner, who will be able to learn the basics of the language in seven days. This practical book comes with important concepts that introduce the foundation of the C# programming language. This book addresses the challenges and issues that most beginners face. It covers issues such as the need to learn C#, issues with setting up a development environment with C#, challenges such as mathematical operations, and other day-to-day problems. Its fast-paced writing style allows the reader to get up and running in no time. We begin with the absolute basics in the first chapter (variables, syntax, control flows, and so on), and then move on to concepts such as statements, arrays, string processing, methods, inheritance, I/O handling, and so on. Every chapter is followed by an exercise that focuses on building something with the language. This book is a fast-paced guide to get readers upto speed with the language. It works as a reference guide, describing the major features of C#. Readers will be able to build easy and simple code with real-world scenarios. By the end of this book, you will be able to take your skills to the next level, with a good knowledge of the fundamentals of C#.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You will get the following code in the Program.cs class. This is the default code provided by Visual Studio; you can amend it as you need." A block of code is set as follows:

var class1 = newClassExample(); 
var class2 = new Day02New.ClassExample(); 
    class1.Display(); 
    class2.Display(); 

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "From Workloads, select the options you want to install. For our book, we need .NET desktop development and .NET Core."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply email [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files emailed directly to you. You can download the code files by following these steps:

  1. Log in or register to our website using your email address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learn-CSharp-in-7-Days. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

 

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title. To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at [email protected] with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.