Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learn C# in 7 days
Learn C# in 7 days

Learn C# in 7 days: Get up and running with C# 7 with async main, tuples, pattern matching, LINQ, regex, indexers, and more

eBook
$24.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Learn C# in 7 days

Day 01 - Overview of the .NET Framework

This is Day 01 of our seven day journey to learn C#. Today, we will begin with an introduction of a new world of programming and will discuss all the basic concepts required to learn this programming language. We will also discuss the .NET Framework and the .NET Core framework by covering important concepts of the framework. We will also get a basic understanding of managed and unmanaged code. At the end of the day, we will start with a simple Hello World program.

Today, we will learn the following topics:

  • What is programming?
  • What is .NET Core?
  • What is .NET standard?

What is programming?

There might be various definitions or various thoughts to define the word programming. In my view, programming is writing a solution in such a way that a machine (computer) can understand to depict the solution, which you can identify manually.

For example, let’s say you have a problem statement: find the total count of vowels from this book. If you want to find the solution to this statement, what will you do?

The probable steps for the solution to this problem are as follows:

  1. First, get the right book. I am assuming that you know the vowels (a, e, i, o, and u).
  1. How many vowels did you find in a book?--0 (zero).
  2. Open the current page (initially, our current page is 1) and start reading to find vowels.
  3. If the letter matches a, e, i, o, or u (please note that the case doesn’t matter, so the letters might as well be A, E, I, O, and U), then increase the vowel count by one.
  4. Is the current page completed?
  5. If the answer of step 5 is yes, then check if this is the last page of the book:

    • If yes, then we have the total vowel count in hand, which is nothing but n, where n is the total number of vowels found in the current chapter. Move to step 8 for the result.
    • If this is not the last chapter, move to the next chapter by adding 1 to the current chapter number. So, we should move to 1 + 1 = 2 (Chapter 2).
  6. In the next chapter, repeat steps 4 to 6 and until you reach the last chapter of the book.
  7. Finally, we have the total vowel count, that is, n (n is the total number of vowels found).

The preceding steps just described how we reached a perfect solution for our problem statement. These steps showed how we manually found the answer to our problem of counting all the vowels in the book's chapters.

In the programming world, such steps are collectively known as an algorithm.

An algorithm is nothing but a process to solve a problem by defining a set of rules.

When we write the preceding step(s)/algorithm in such a way that a machine/computer will be able to follow the instructions, it is called programming. These instructions should be written in a language understood by the machine/computer, and this is what is called a programming language.

In this book, we will use C# 7.0 as the programming language and .NET Core as the framework.

What is .NET?

While we are referring to .NET (pronounced as dot NET), it is .NET Full, as we have .NET Core in place and we are using .NET Core in our book examples with C# 7.0 as the language. Before moving ahead, you should know about .NET because there is a .NET Standard available with the .NET Core, that is API servers for both .NET Framework as well .NET Core. So, if you created a project using .NET Standard it is valid for both .NET Framework and .NET Core.

.NET is nothing but a combination of languages, runtime, and libraries, by using which we can develop managed software/applications. The software written in .NET is managed or is in a managed environment. To understand managed, we need to dig into how binary executables are available for operating systems. This comprises three broader steps:

  1. Writing the code (source code).
  2. Compiler compiles the source code.
  3. The operating system executes the binary executable immediately:
Broader steps – how binary executable is available?

The preceding process is a standard process depicting how compilers compile the source code and create executable binaries, but in the case of .NET, the compiler (C# compiler for our code) does not directly provide a binary executable; it provides an assembly and this assembly consists of metadata and intermediate language code, also known as Microsoft Intermediate Language (MSIL) or Intermediate Language (IL). This MSIL is a high-level language and this can’t be understood directly by the machine, as MSIL is not machine-specific code or byte code. For proper execution, it should be interpreted. This interpretation from MSIL or IL to the machine language happens with the help of JIT. In other words, JIT compiles MSIL, IL into the machine language, also called native code. For more information, refer to https://msdn.microsoft.com/en-us/library/ht8ecch6(v=vs.90).aspx.

For 64-bit compilation, Microsoft has announced RyuJIT (https://blogs.msdn.microsoft.com/dotnet/2014/02/27/ryujit-ctp2-getting-ready-for-prime-time/). In the coming versions, 32-bit compilation will also be handled by RyuJIT (https://github.com/dotnet/announcements/issues/10). After this, we can now have a single code base for both CoreCLR.

Intermediate language is a high-level component-based assembly language.

In our seven days of learning, we will not focus on the framework, but we will be more focused on the C# language with the use of .NET Core. In the coming sections, we will discuss important things of .NET Core in such a way that while we work with a C# program, we should understand how our program talks with the operating system.

What is .NET Core?

.NET Core is a new general-purpose development environment introduced by Microsoft to meet cross-platform requirements. .NET Core supports Windows, Linux, and OSX.

.NET Core is an open source software development framework released under MIT License and maintained by the Microsoft and .NET community on the GitHub (https://github.com/dotnet/core) repository.

.NET Core features

Here are some important features of .NET Core, that make .NET Core an important evolution step in software development:

What makes .NET Core?

.NET Core is a combination of coreclr, corefx, and cli and roslyn. These are the main components of .NET Core composition.

What is .NET Standard?

The .NET Standard is a set of APIs that resolves the problems of code sharing while you’re trying to write cross-platform applications. Currently, Microsoft is working on .NET Standard 2.0 to make it streamlined, and these standards will be implemented by all, that is, .NET Framework, .NET Core, and Xamarin. With the use of .NET Standard (that is a set of APIs), you are ensuring that your program and class library will be available for all targeted .NET Frameworks and .NET Core. In other words, .NET Standard will replace Portable Class Libraries (PCL). For more information, refer to https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/.

The .NET Standard 2.0 repository is available at https://github.com/dotnet/standard.

Till now, you've got an idea of .NET Core and a few other things that help build cross-platform applications. In the coming sections, we will prepare the environment in order to start learning the C# language using Visual Studio 2017 (preferably the community edition).

Available IDEs and editors for C#

Integrated Development Environment (IDE) is nothing but software facilitating the development of applications. On the other hand, editors are basically meant to add/update predefined or new content. When we talk about the C# editor, we are referring to an editor that helps write C# programs. Some editors come with a lot of add-ons or plugins and can compile or run the programs.

We will use Visual Studio 2017 as our preferred C# IDE; however, there are a few more C# IDEs and editors you can go with:

  1. Visual Studio Code: VS Code is an editor, and you can start by downloading it from https://code.visualstudio.com/. To start with VS Code, you need to install the C# extension from https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp.
  2. Cloud9: It is a web browser-based IDE. You can start it for free by signing up at https://c9.io/signup.
  3. JetBrain Rider: This is a cross-platform IDE by JetBrains. For more information, visit https://www.jetbrains.com/rider/.
  4. Zeus IDE: This is an IDE designed for the Windows platform. You can start using Zeus from https://www.zeusedit.com/index.html.
  1. Text editor: This is the way you can go without any installation; just use a text editor of your choice. I use Notepad++ (https://notepad-plus-plus.org/download/v7.3.3.html) and the Command Line Interface (CLI) to build code. Refer to https://docs.microsoft.com/en-us/dotnet/articles/core/tools/ to know more about how to start with the CLI.

There may be more alternative IDEs and editors, but they are not as important to us.

Setting up the environment

In this section, we will see step by step how to initiate the installation of Visual Studio 2017 (preferably, the community edition) on Windows 10:

  1. Go to https://www.visualstudio.com/downloads/ (you can also get the benefits of Dev Essentials from https://www.visualstudio.com/dev-essentials/).
  2. Download Visual Studio Community (https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15):
  1. Start the Visual Studio setup.
  1. From Workloads, select the options you want to install. For our book, we need .NET desktop development and .NET Core:
  1. Click on Install to start the installation:
  1. Click Launch once the installation is completed.
  2. Sign up for Visual Studio using your Live ID.
  3. Select Visual C# as your development setting.
  4. You will see the start page as follows:

We are all set to start with our first step.

Hands - on exercises

Answer the following questions by covering the concepts of today’s learning.

  • What is programming? Write down an algorithm to find out vowel counts from all the pages of book, Learn C# in 7-days.
  • What is .NET Core and .NET Standard?
  • What makes a .NET Core an evolutional software ?

Revisiting Day 01

Today, we walked you through some important concepts of .NET Core and .NET Standard. You learned what programs and algorithms are in the programming world.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn the basics of C# in 7 days
  • Works as a reference guide describing the major features of C#
  • Build easy and simple code through real-world example scenarios

Description

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#.

Who is this book for?

The book is for aspiring developers and absolute novices who want to get started with the world of programming. You do not need any knowledge of C# for this book.

What you will learn

  • Understand and set up the .NET environment
  • Code in C# using the Visual Studio 2017 RC (preferable community edition) IDE
  • Define variables, syntax, control flows, statements, and arrays etc through examples
  • Understand the concepts of Object-Oriented Programming using C#
  • Get acquainted with attributes, collection, generics, and LINQ
  • Get your hands on class members such as Modifiers, Methods, Properties, Indexers, File I/O, Exception Handling, and Regex
  • Build a real-world application using C# 7
Estimated delivery fee Deliver to Colombia

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 06, 2017
Length: 306 pages
Edition : 1st
Language : English
ISBN-13 : 9781787287044
Vendor :
Microsoft
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Estimated delivery fee Deliver to Colombia

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

Product Details

Publication date : Oct 06, 2017
Length: 306 pages
Edition : 1st
Language : English
ISBN-13 : 9781787287044
Vendor :
Microsoft
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 167.97
C# 7.1 and .NET Core 2.0 ??? Modern Cross-Platform Development
$79.99
Beginning C# 7 Hands-On ??? Advanced Language Features
$43.99
Learn C# in 7 days
$43.99
Total $ 167.97 Stars icon

Table of Contents

8 Chapters
Day 01 - Overview of the .NET Framework Chevron down icon Chevron up icon
Day 02 - Getting Started with C# Chevron down icon Chevron up icon
Day 03 - What's New in C# Chevron down icon Chevron up icon
Day 04 - Discussing C# Class Members Chevron down icon Chevron up icon
Day 05 - Overview of Reflection and Collections Chevron down icon Chevron up icon
Day 06 - Deep Dive with Advanced Concepts Chevron down icon Chevron up icon
Day 07 - Understanding Object-Oriented Programming with C# Chevron down icon Chevron up icon
Day 08 - Test Your Skills – Build a Real-World Application Chevron down icon Chevron up icon

Customer reviews

Most Recent
Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.7
(7 Ratings)
5 star 28.6%
4 star 0%
3 star 28.6%
2 star 0%
1 star 42.9%
Filter icon Filter
Most Recent

Filter reviews by




Bernhard Feb 04, 2024
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Not my style of teaching. Examples not easy to understand and to much references to other sources. I want to learn a little bit of LINQ and not one example and a link?! And finally a project with no link to the source code? Can't recommend this book!
Subscriber review Packt
Ronnie Jul 11, 2018
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
This book uses jargon without explaining it first, refers to concepts as if the reader knows it already without explaining it first, spelling yada yada yada....
Amazon Verified review Amazon
Amazon Customer Apr 25, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This book is not for beginners ,textual explanation is good but to follow the code snippets you have to have some prior experience with c#
Amazon Verified review Amazon
Ian Graham Apr 17, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This book is littered with typos and grammatical errors, it does not read well. The concepts skip around a lot and most information is presented using very repetitive language. The information is decent, if you already have a strong foundation in programming concepts. This is not a book for beginners, however.If you're a seasoned programmer and you want to dive quickly into C#, and need the latest version, this is a good place to start. For a more complete experience, look elsewhere. You will be better off learning an outdated version of the language and bringing yourself up to speed on your own.
Amazon Verified review Amazon
Tomasz Zawada Feb 04, 2018
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Well, good luck to those who gave this book 5 starts...Cant really follow the logic of this book.Things are being introduced in a fairly random order (easy concepts are being mixed with advanced ones straight away). The code snippets are not really thought through as there is plenty of unnecessary code around the actual idea to be illustrated.There are too many links to external pages, which makes the reading even more difficult, and the feeling is that without following the link one does not get enough info from reading the actual book. By the way things can go even blurrier, as many code blocks (at lest in my Kindle version) are just left justified.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela