Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals
C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals

C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals: Start building websites and services with ASP.NET Core 7, Blazor, and EF Core 7 , Seventh Edition

eBook
$35.98 $39.99
Paperback
$49.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals

Speaking C#

This chapter is all about the basics of the C# programming language. Over the course of this chapter, you’ll learn how to write statements using the grammar of C#, as well as being introduced to some of the common vocabulary that you will use every day. In addition to this, by the end of the chapter, you’ll feel confident in knowing how to temporarily store and work with information in your computer’s memory.

This chapter covers the following topics:

  • Introducing the C# language
  • Understanding C# grammar and vocabulary
  • Working with variables
  • Exploring more about console apps
  • Understanding async and await

Introducing the C# language

This part of the book is about the C# language—the grammar and vocabulary that you will use every day to write the source code for your applications.

Programming languages have many similarities to human languages, except that in programming languages, you can make up your own words, just like Dr. Seuss!

In a book written by Dr. Seuss in 1950, If I Ran the Zoo, he states this:

”And then, just to show them, I’ll sail to Ka-Troo And Bring Back an It-Kutch, a Preep, and a Proo, A Nerkle, a Nerd, and a Seersucker, too!”

Understanding language versions and features

This part of the book covers the C# programming language and is written primarily for beginners, so it covers the fundamental topics that all developers need to know, from declaring variables to storing data to how to define your own custom data types.

This book covers features of the C# language from version 1 up to the latest version, 11.

If you already have some familiarity with older versions of C# and are excited to find out about the new features in the most recent versions of C#, I have made it easier for you to jump around by listing language versions and their important new features below, along with the chapter number and topic title where you can learn about them.

Project COOL

Before the first release of C#, it had the codename COOL (C-like Object-Oriented Language).

C# 1

C# 1 was released in February 2002 and included all the important features of a statically typed object-oriented modern language, as you will see throughout Chapters 2 to 6.

C# 1.2

C# 1.2, with a few minor improvements like automatic disposal at the end of foreach statements, was released with Visual Studio .NET 2003.

C# 2

C# 2 was released in 2005 and focused on enabling strong data typing using generics, to improve code performance and reduce type errors, including the topics listed in the following table:

Feature

Chapter

Topic

Nullable value types

6

Making a value type nullable

Generics

6

Making types more reusable with generics

C# 3

C# 3 was released in 2007 and focused on enabling declarative coding with Language INtegrated Queries (LINQ) and related features like anonymous types and lambda expressions, including the topics listed in the following table:

Feature

Chapter

Topic

Implicitly typed local variables

2

Inferring the type of a local variable

LINQ

11

All topics in Chapter 11, Querying and Manipulating Data Using LINQ

C# 4

C# 4 was released in 2010 and focused on improving interoperability with dynamic languages like F# and Python, including the topics listed in the following table:

Feature

Chapter

Topic

Dynamic types

2

Storing dynamic types

Named/optional arguments

5

Optional parameters and named arguments

C# 5

C# 5 was released in 2012 and focused on simplifying asynchronous operation support by automatically implementing complex state machines while writing what looks like synchronous statements, including the topics listed in the following table:

Feature

Chapter

Topic

Simplified asynchronous tasks

2

Understanding async and await

C# 6

C# 6 was released in 2015 and focused on minor refinements to the language, including the topics listed in the following table:

Feature

Chapter

Topic

static imports

2

Simplifying the usage of the console

Interpolated strings

2

Displaying output to the user

Expression-bodied members

5

Defining read-only properties

C# 7.0

C# 7.0 was released in March 2017 and focused on adding functional language features like tuples and pattern matching, as well as minor refinements to the language, including the topics listed in the following table:

Feature

Chapter

Topic

Binary literals and digit separators

2

Storing whole numbers

Pattern matching

3

Pattern matching with the if statement

out variables

5

Controlling how parameters are passed

Tuples

5

Combining multiple values with tuples

Local functions

6

Defining local functions

C# 7.1

C# 7.1 was released in August 2017 and focused on minor refinements to the language, including the topics listed in the following table:

Feature

Chapter

Topic

async Main

2

Improving responsiveness for console apps

Default literal expressions

5

Setting fields with default literal

Inferred tuple element names

5

Inferring tuple names

C# 7.2

C# 7.2 was released in November 2017 and focused on minor refinements to the language, including the topics listed in the following table:

Feature

Chapter

Topic

Leading underscores in numeric literals

2

Storing whole numbers

Non-trailing named arguments

5

Optional parameters and named arguments

private protected access modifier

5

Understanding access modifiers

You can test == and != with tuple types

5

Comparing tuples

C# 7.3

C# 7.3 was released in May 2018 and focused on performance-oriented safe code that improves ref variables, pointers, and stackalloc. These are advanced and rarely needed for most developers, so they are not covered in this book.

C# 8

C# 8 was released in September 2019 and focused on a major change to the language related to null handling, including the topics listed in the following table:

Feature

Chapter

Topic

Switch expressions

3

Simplifying switch statements with switch expressions

Nullable reference types

6

Making a reference type nullable

Default interface methods

6

Understanding default interface methods

C# 9

C# 9 was released in November 2020 and focused on record types, refinements to pattern matching, and minimal-code projects, including the topics listed in the following table:

Feature

Chapter

Topic

Minimal-code console apps

1

Top-level programs

Target-typed new

2

Using target-typed new to instantiate objects

Enhanced pattern matching

5

Pattern matching with objects

Records

5

Working with records

C# 10

C# 10 was released in November 2021 and focused on features that minimize the amount of code needed in common scenarios, including the topics listed in the following table:

Feature

Chapter

Topic

Global namespace imports

2

Importing namespaces

Constant string literals

2

Formatting using interpolated strings

File-scoped namespaces

5

Simplifying namespace declarations

Record structs

6

Working with record struct types

ArgumentNullException.ThrowIfNull

6

Checking for null in method parameters

C# 11

C# 11 was released in November 2022 and focused on features that simplify your code, including the topics listed in the following table:

Feature

Chapter

Topic

Raw string literals

2

Understanding raw string literals

Line breaks in interpolated string expressions

2

Formatting using interpolated strings

Required properties

5

Requiring properties to be set during instantiation

Understanding C# standards

Over the years, Microsoft has submitted a few versions of C# to standards bodies, as shown in the following table:

C# version

ECMA standard

ISO/IEC standard

1.0

ECMA-334:2003

ISO/IEC 23270:2003

2.0

ECMA-334:2006

ISO/IEC 23270:2006

5.0

ECMA-334:2017

ISO/IEC 23270:2018

The ECMA standard for C# 6 is still a draft, and work on adding C# 7 features is progressing. Microsoft made C# open source in 2014. You can read the C# ECMA standard document at the following link: https://www.ecma-international.org/publications-and-standards/standards/ecma-334/.

More practically useful than the ECMA standards are the public GitHub repositories for making the work on C# and related technologies as open as possible, as shown in the following table:

Description

Link

C# language design

https://github.com/dotnet/csharplang

Compiler implementation

https://github.com/dotnet/roslyn

Standard to describe the language

https://github.com/dotnet/csharpstandard

Discovering your C# compiler versions

The .NET language compiler for C# and Visual Basic, also known as Roslyn, along with a separate compiler for F#, is distributed as part of the .NET SDK. To use a specific version of C#, you must have at least that version of the .NET SDK installed, as shown in the following table:

.NET SDK

Roslyn compiler

Default C# language

1.0.4

2.0 - 2.2

7.0

1.1.4

2.3 - 2.4

7.1

2.1.2

2.6 - 2.7

7.2

2.1.200

2.8 - 2.10

7.3

3.0

3.0 - 3.4

8.0

5.0

3.8

9.0

6.0

4.0

10.0

7.0

4.4

11.0

When you create class libraries, you can choose to target .NET Standard as well as versions of modern .NET. They have default C# language versions, as shown in the following table:

.NET Standard

C#

2.0

7.3

2.1

8.0

Although you must have a minimum version of the .NET SDK installed to have access to a specific compiler version, the projects that you create can target older versions of .NET and still use a modern compiler version. For example, if you have the .NET 7 SDK or later installed, then you could use C# 11 language features in a console app that targets .NET Core 3.0.

How to output the SDK version

Let’s see what .NET SDK and C# language compiler versions you have available:

  1. On Windows, start Windows Terminal or Command Prompt. On macOS, start Terminal.
  2. To determine which version of the .NET SDK you have available, enter the following command:
    dotnet --version
    
  3. Note that the version at the time of publishing is 7.0.100, indicating that it is the initial version of the SDK without any bug fixes or new features yet, as shown in the following output:
    7.0.100
    

Enabling a specific language version compiler

Developer tools like Visual Studio and the dotnet command-line interface assume that you want to use the latest major version of a C# language compiler by default. Before C# 8.0 was released, C# 7.0 was the latest major version and was used by default. To use the improvements in a C# point release like 7.1, 7.2, or 7.3, you had to add a <LangVersion> configuration element to the project file, as shown in the following markup:

<LangVersion>7.3</LangVersion>

After the release of C# 11 with .NET 7, if Microsoft releases a C# 11.1 compiler and you want to use its new language features, then you will have to add a configuration element to your project file, as shown in the following markup:

<LangVersion>11.1</LangVersion>

Potential values for the <LangVersion> are shown in the following table:

LangVersion

Description

7, 7.1, 7.2, 7.3, 8, 9, 10, 11

Entering a specific version number will use that compiler if it has been installed.

latestmajor

Uses the highest major number, for example, 7.0 in August 2019, 8 in October 2019, 9 in November 2020, 10 in November 2021, and 11 in November 2022.

latest

Uses the highest major and highest minor number, for example, 7.2 in 2017, 7.3 in 2018, 8 in 2019, and perhaps 11.1 in H1 2023.

preview

Uses the highest available preview version, for example, 11.0 in July 2022 with .NET 7.0 Preview 6 installed.

After creating a new project, you can edit the .csproj file and add the <LangVersion> element, as shown highlighted in the following markup:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <LangVersion>preview</LangVersion>
  </PropertyGroup>
</Project>

Switching the C# compiler for .NET 6

.NET 6 is an LTS release, so Microsoft must support developers who continue to use .NET 6 for six months longer than .NET 7. With .NET SDK 6.0.200 and later, which was released in February 2022, you can set the language version to preview to start exploring C# 11 language features. I expect that whatever version is released alongside .NET SDK 7.0.100 on November 8, 2022 (probably .NET SDK 6.0.500), it will default to using the C# 10 compiler unless you explicitly set the language version to 11, as shown highlighted in the following markup:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <LangVersion>11</LangVersion>
  </PropertyGroup>
</Project>

If you target net7.0, which your projects will do by default if you have installed the .NET 7 SDK, then the default language will be C# 11 so it does not need to be explicitly set.

Good Practice: If you are using Visual Studio Code and you have not done so already, install the Visual Studio Code extension named MSBuild project tools. This will give you IntelliSense while editing .csproj files, including making it easy to add the <LangVersion> element with appropriate values.

Understanding C# grammar and vocabulary

To learn simple C# language features, you can use Polyglot Notebooks, which remove the need to create an application of any kind.

To learn some other C# language features, you will need to create an application. The simplest type of application is a console app.

Let’s start by looking at the basics of the grammar and vocabulary of C#. Throughout this chapter, you will create multiple console apps, with each one showing related features of the C# language.

Showing the compiler version

We will start by writing code that shows the compiler version:

  1. If you’ve completed Chapter 1, Hello, C#! Welcome, .NET!, then you will already have a cs11dotnet7 folder. If not, then you’ll need to create it.
  2. Use your preferred code editor to create a new project, as defined in the following list:
    • Project template: Console App [C#]/console
    • Project file and folder: Vocabulary
    • Workspace/solution file and folder: Chapter02

    Good Practice: If you have forgotten how, or did not complete the previous chapter, then step-by-step instructions for creating a workspace/solution with multiple projects are given in Chapter 1, Hello, C#! Welcome, .NET!.

  1. Open the Program.cs file, and under the comment, add a statement to show the C# version as an error, as shown in the following code:
    #error version
    
  2. Run the console app:
    • If you are using Visual Studio Code, then in a terminal, enter the command dotnet run.
    • If you are using Visual Studio 2022, then navigate to Debug | Start Without Debugging. When prompted to continue and run the last successful build, click No.
  3. Note that the compiler version and the language version appear as a compiler error message number CS8304, as shown in Figure 2.1:

Figure 2.1: A compiler error that shows the C# language version

  1. The error message in the Visual Studio Code PROBLEMS window or Visual Studio Error List window says Compiler version: ‘4.4.0...’ with language version default (11.0).
  2. Comment out the statement that causes the error, as shown in the following code:
    // #error version
    
  3. Note that the compiler error messages disappear.

Understanding C# grammar

The grammar of C# includes statements and blocks. To document your code, you can use comments.

Good Practice: Comments should not be the only way that you document your code. Choosing sensible names for variables and functions, writing unit tests, and creating actual documents are other ways to document your code.

Statements

In English, we indicate the end of a sentence with a full stop. A sentence can be composed of multiple words and phrases, with the order of words being part of the grammar. For example, in English, we say “the black cat.”

The adjective, black, comes before the noun, cat. Whereas French grammar has a different order; the adjective comes after the noun: “le chat noir.” What’s important to take away from this is that the order matters.

C# indicates the end of a statement with a semicolon. A statement can be composed of multiple variables and expressions. For example, in the following statement, totalPrice is a variable and subtotal + salesTax is an expression:

var totalPrice = subtotal + salesTax;

The expression is made up of an operand named subtotal, an operator +, and another operand named salesTax. The order of operands and operators matters.

Comments

Comments are the primary method of documenting your code to increase understanding of how it works, for other developers to read, or even yourself when you come back to it months later.

In Chapter 4, Writing, Debugging, and Testing Functions, you will learn about XML comments that work with a tool to generate web pages to document your code.

You can add comments to explain your code using a double slash, //. The compiler will ignore everything after the // until the end of the line, as shown in the following code:

// sales tax must be added to the subtotal
var totalPrice = subtotal + salesTax;

To write a multiline comment, use /* at the beginning and */ at the end of the comment, as shown in the following code:

/*
This is a 
multi-line comment.
*/

Although /* */ is most commonly used for multiline comments, it is also useful for commenting in the middle of a statement, as shown in the following code:

var totalPrice = subtotal /* for this item */ + salesTax;

Good Practice: Well-designed code, including function signatures with well-named parameters and class encapsulation, can be somewhat self-documenting. When you find yourself putting too many comments and explanations in your code, ask yourself: can I rewrite, aka refactor, this code to make it more understandable without long comments?

Your code editor has commands to make it easier to add and remove comment characters, as shown in the following list:

  • Visual Studio 2022 for Windows: Navigate to Edit | Advanced | Comment Selection or Uncomment Selection.
  • Visual Studio Code: Navigate to Edit | Toggle Line Comment or Toggle Block Comment.

Good Practice: You comment code by adding descriptive text above or after code statements. You comment out code by adding comment characters before or around statements to make them inactive. Uncommenting means removing the comment characters.

Blocks

In English, we indicate a new paragraph by starting a new line. C# indicates a block of code with the use of curly brackets, { }.

Blocks start with a declaration to indicate what is being defined. For example, a block can define the start and end of many language constructs including namespaces, classes, methods, or statements like foreach.

You will learn more about namespaces, classes, and methods later in this chapter and subsequent chapters, but to briefly introduce some of those concepts now:

  • A namespace contains types like classes to group them together.
  • A class contains the members of an object, including methods.
  • A method contains statements that implement an action that an object can take.

Examples of statements and blocks

In a simple console app that does not use the top-level program feature, I’ve added some comments to the statements and blocks, as shown in the following code:

using System; // a semicolon indicates the end of a statement
namespace Basics
{ // an open brace indicates the start of a block
  class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine("Hello World!"); // a statement
    }
  }
} // a close brace indicates the end of a block

Understanding C# vocabulary

The C# vocabulary is made up of keywords, symbol characters, and types.

Some of the predefined, reserved keywords that you will see in this book include using, namespace, class, static, int, string, double, bool, if, switch, break, while, do, for, foreach, and, or, not, record, and init.

Some of the symbol characters that you will see include ", ', +, -, *, /, %, @, and $.

There are other contextual keywords that only have a special meaning in a specific context.

However, that still means that there are only about 100 actual C# keywords in the language.

Good Practice: C# keywords use all lowercase. Although you can use all lowercase for your own names in your type names, you should not. With C# 11 and later, the compiler will give a warning if you do, as shown in the following output:

Warning CS8981 The type name 'person' only contains lower-cased ascii characters. Such names may become reserved for the language.

Comparing programming languages to human languages

The English language has more than 250,000 distinct words, so how does C# get away with only having about 100 keywords? Moreover, why is C# so difficult to learn if it has only 0.0416% of the number of words in the English language?

One of the key differences between a human language and a programming language is that developers need to be able to define the new “words” with new meanings. Apart from the (about) 100 keywords in the C# language, this book will teach you about some of the hundreds of thousands of “words” that other developers have defined, but you will also learn how to define your own “words.”

Programmers all over the world must learn English because most programming languages use English words such as “namespace” and “class.” There are programming languages that use other human languages, such as Arabic, but they are rare. If you are interested in learning more, this YouTube video shows a demonstration of an Arabic programming language: https://youtu.be/dkO8cdwf6v8.

Changing the color scheme for C# syntax

By default, Visual Studio 2022 and Visual Studio Code show C# keywords in blue to make them easier to differentiate from other code. Both tools allow you to customize the color scheme.

In Visual Studio 2022:

  1. Navigate to Tools | Options.
  2. In the Options dialog box, in the Environment section, select Fonts and Colors, and then select the display items that you would like to customize. You can also search for the section instead of browsing for it.

In Visual Studio Code:

  1. Navigate to File | Preferences | Color Theme. It is in the Code menu on macOS.
  2. Select a color theme. For reference, I’ll use the Light+ (default light) color theme so that the screenshots look better in a printed book.

Help for writing correct code

Plain text editors such as Notepad don’t help you write correct English. Likewise, Notepad won’t help you write correct C# either.

Microsoft Word can help you write English by highlighting spelling mistakes with red squiggles, with Word saying that “icecream” should be ice-cream or ice cream, and grammatical errors with blue squiggles, such as a sentence should have an uppercase first letter.

Similarly, Visual Studio 2022 and Visual Studio Code’s C# extension help you write C# code by highlighting spelling mistakes, such as the method name should be WriteLine with an uppercase L, and grammatical errors, such as statements that must end with a semicolon.

The C# extension constantly watches what you type and gives you feedback by highlighting problems with colored squiggly lines, like that of Microsoft Word.

Let’s see it in action:

  1. In Program.cs, change the L in the WriteLine method to lowercase.
  2. Delete the semicolon at the end of the statement.
  3. In Visual Studio Code, navigate to View | Problems, or in Visual Studio, navigate to View | Error List, and note that a red squiggle appears under the code mistakes and details are shown, as you can see in Figure 2.2:
Graphical user interface, text, application, Word  Description automatically generated

Figure 2.2: The Error List window showing two compile errors

  1. Fix the two coding errors.

Importing namespaces

System is a namespace, which is like an address for a type. To refer to someone’s location exactly, you might use Oxford.HighStreet.BobSmith, which tells us to look for a person named Bob Smith on the High Street in the city of Oxford.

System.Console.WriteLine tells the compiler to look for a method named WriteLine in a type named Console in a namespace named System.

To simplify our code, the Console App project template for every version of .NET before 6.0 added a statement at the top of the code file to tell the compiler to always look in the System namespace for types that haven’t been prefixed with their namespace, as shown in the following code:

using System; // import the System namespace

We call this importing the namespace. The effect of importing a namespace is that all available types in that namespace will be available to your program without needing to enter the namespace prefix, and will be seen in IntelliSense while you write code.

Polyglot Notebooks have most namespaces imported automatically.

Implicitly and globally importing namespaces

Traditionally, every .cs file that needs to import namespaces would have to start with using statements to import those namespaces. Namespaces like System and System.Linq are needed in almost all .cs files, so the first few lines of every .cs file often had at least a few using statements, as shown in the following code:

using System;
using System.Linq;
using System.Collections.Generic;

When creating websites and services using ASP.NET Core, there are often dozens of namespaces that each file would have to import.

C# 10 introduced a new keyword combination and .NET SDK 6 introduced a new project setting that work together to simplify importing common namespaces.

The global using keyword combination means you only need to import a namespace in one .cs file and it will be available throughout all .cs files. You could put global using statements in the Program.cs file, but I recommend creating a separate file for those statements named something like GlobalUsings.cs with the contents being all your global using statements, as shown in the following code:

global using System;
global using System.Linq;
global using System.Collections.Generic;

Good Practice: As developers get used to this new C# feature, I expect one naming convention for this file to become the standard. As you are about to see, the related .NET SDK feature uses a similar naming convention.

Any projects that target .NET 6.0 or later, and therefore use the C# 10 or later compiler, generate a <ProjectName>.GlobalUsings.g.cs file in the obj\Debug\net7.0 folder to implicitly globally import some common namespaces like System. The specific list of implicitly imported namespaces depends on which SDK you target, as shown in the following table:

SDK

Implicitly imported namespaces

Microsoft.NET.Sdk

System

System.Collections.Generic

System.IO

System.Linq

System.Net.Http

System.Threading

System.Threading.Tasks

Microsoft.NET.Sdk.Web

Same as Microsoft.NET.Sdk and:

System.Net.Http.Json

Microsoft.AspNetCore.Builder

Microsoft.AspNetCore.Hosting

Microsoft.AspNetCore.Http

Microsoft.AspNetCore.Routing

Microsoft.Extensions.Configuration

Microsoft.Extensions.DependencyInjection

Microsoft.Extensions.Hosting

Microsoft.Extensions.Logging

Microsoft.NET.Sdk.Worker

Same as Microsoft.NET.Sdk and:

Microsoft.Extensions.Configuration

Microsoft.Extensions.DependencyInjection

Microsoft.Extensions.Hosting

Microsoft.Extensions.Logging

Let’s see the current autogenerated implicit imports file:

  1. If you are using Visual Studio 2022, then in Solution Explorer, select the Vocabulary project, toggle on the Show All Files button, and note the compiler-generated bin and obj folders are now visible.
  2. Expand the obj folder, expand the Debug folder, expand the net7.0 folder, and open the file named Vocabulary.GlobalUsings.g.cs.

    The naming convention for this file is <ProjectName>.GlobalUsings.g.cs. Note the g for generated to differentiate from developer-written code files.

  1. Remember that this file is automatically created by the compiler for projects that target .NET 6.0, and that it imports some commonly used namespaces, including System.Threading, as shown in the following code:
    // <autogenerated />
    global using global::System;
    global using global::System.Collections.Generic;
    global using global::System.IO;
    global using global::System.Linq;
    global using global::System.Net.Http;
    global using global::System.Threading;
    global using global::System.Threading.Tasks;
    
  2. Close the Vocabulary.GlobalUsings.g.cs file.
  3. In Solution Explorer, select the project, and then add additional entries to the project file to control which namespaces are implicitly imported, as shown highlighted in the following markup:
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net7.0</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
      </PropertyGroup>
      <ItemGroup>
        <Using Remove="System.Threading" />
        <Using Include="System.Numerics" />
      </ItemGroup>
    </Project>
    

    Note that <ItemGroup> is different from <ImportGroup>. Be sure to use the correct one! Also note that the order of elements in a project group or item group does not matter. For example, <Nullable> can be before or after <ImplicitUsings>.

  1. Save the changes to the project file.
  2. Expand the obj folder, expand the Debug folder, expand the net7.0 folder, and open the file named Vocabulary.GlobalUsings.g.cs.
  3. Note this file now imports System.Numerics instead of System.Threading, as shown highlighted in the following code:
    // <autogenerated />
    global using global::System;
    global using global::System.Collections.Generic;
    global using global::System.IO;
    global using global::System.Linq;
    global using global::System.Net.Http;
    global using global::System.Numerics;
    global using global::System.Threading.Tasks;
    
  4. Close the Vocabulary.GlobalUsings.g.cs file.

You can disable the implicitly imported namespaces feature for all SDKs by removing the <ImplicitUsings> element completely from the project file, or changing its value to disable, as shown in the following markup:

<ImplicitUsings>disable</ImplicitUsings>

If you are using Visual Studio 2022, then you can control project settings in the user interface:

  1. In Solution Explorer, right-click the Vocabulary project and select Properties.
  2. Click Build and note it has a General section opened by default.
  3. Scroll down and note the sections to control nullability and implicit imports, as shown in Figure 2.3:

Figure 2.3: Controlling project settings in the Visual Studio 2022 user interface

  1. Close the project properties.

Verbs are methods

In English, verbs are doing or action words, like “run” and “jump.” In C#, doing or action words are called methods. There are hundreds of thousands of methods available to C#. In English, verbs change how they are written based on when in time the action happens. For example, Amir was jumping in the past, Beth jumps in the present, they jumped in the past, and Charlie will jump in the future.

In C#, methods such as WriteLine change how they are called or executed based on the specifics of the action. This is called overloading, which we’ll cover in more detail in Chapter 5, Building Your Own Types with Object-Oriented Programming. But for now, consider the following example:

// Outputs the current line terminator string.
// By default, this is a carriage-return and line feed.
Console.WriteLine();
// Outputs the greeting and the current line terminator string.
Console.WriteLine("Hello Ahmed");
// Outputs a formatted number and date and the current line terminator string.
Console.WriteLine("Temperature on {0:D} is {1}°C.", DateTime.Today, 23.4);

When I show code snippets without numbered step-by-step instructions for you to enter the code, I do not expect you to enter the code, so it might not execute out-of-context.

A different analogy is that some words are spelled the same but have different meanings depending on the context.

Nouns are types, variables, fields, and properties

In English, nouns are names that refer to things. For example, Fido is the name of a dog. The word “dog” tells us the type of thing that Fido is, and so to order Fido to fetch a ball, we would use his name.

In C#, their equivalents are types, variables, fields, and properties. For example:

  • Animal and Car are types; they are nouns for categorizing things.
  • Head and Engine might be fields or properties; they are nouns that belong to Animal and Car.
  • Fido and Bob are variables; they are nouns for referring to a specific object.

There are tens of thousands of types available to C#, though have you noticed how I didn’t say, “There are tens of thousands of types in C#?” The difference is subtle but important. The language of C# only has a few keywords for types, such as string and int, and strictly speaking, C# doesn’t define any types. Keywords such as string that look like types are aliases, which represent types provided by the platform on which C# runs.

It’s important to know that C# cannot exist alone; after all, it’s a language that runs on variants of .NET. In theory, someone could write a compiler for C# that uses a different platform, with different underlying types. In practice, the platform for C# is .NET, which provides tens of thousands of types to C#, including System.Int32, which is the C# keyword alias int maps to, as well as many more complex types, such as System.Xml.Linq.XDocument.

It’s worth taking note that the term type is often confused with class. Have you ever played the parlor game Twenty Questions, also known as Animal, Vegetable, or Mineral? In the game, everything can be categorized as an animal, vegetable, or mineral. In C#, every type can be categorized as a class, struct, enum, interface, or delegate. You will learn what these mean in Chapter 6, Implementing Interfaces and Inheriting Classes. As examples, the C# keyword string is a class, but int is a struct. So, it is best to use the term type to refer to both.

Revealing the extent of the C# vocabulary

We know that there are more than 100 keywords in C#, but how many types are there? Let’s write some code to find out how many types (and their methods) are available to C# in our simple console app.

Don’t worry about exactly how this code works for now, but know that it uses a technique called reflection:

  1. Delete all the existing statements in Program.cs.
  2. We’ll start by importing the System.Reflection namespace at the top of the Program.cs file, as shown in the following code:
    using System.Reflection;
    

    Good Practice: We could use the implicit imports and global using features to import this namespace for all .cs files in this project, but since there is only one file, it is better to import the namespace in the one file in which it is needed.

  1. Write statements to get the compiled console app and loop through all of the types that it has access to, outputting the names and number of methods each has, as shown in the following code:
    Assembly? myApp = Assembly.GetEntryAssembly();
    if (myApp == null) return; // quit the app
    // loop through the assemblies that my app references
    foreach (AssemblyName name in myApp.GetReferencedAssemblies())
    {
      // load the assembly so we can read its details
      Assembly a = Assembly.Load(name);
      // declare a variable to count the number of methods
      int methodCount = 0;
      // loop through all the types in the assembly
      foreach (TypeInfo t in a.DefinedTypes)
      {
        // add up the counts of methods
        methodCount += t.GetMethods().Count();
      }
      // output the count of types and their methods
      Console.WriteLine(
        "{0:N0} types with {1:N0} methods in {2} assembly.",
        arg0: a.DefinedTypes.Count(),
        arg1: methodCount, 
        arg2: name.Name);
    }
    

    N0 is uppercase N followed by the digit zero. It is not uppercase N followed by uppercase O. It means “format a number (N) with zero (0) decimal places.”

  1. Run the code. You will see the actual number of types and methods that are available to you in the simplest application when running on your OS. The number of types and methods displayed will be different depending on the operating system that you are using, as shown in the following outputs:
    // Output on Windows
    0 types with 0 methods in System.Runtime assembly.
    44 types with 645 methods in System.Console assembly.
    106 types with 1,126 methods in System.Linq assembly.
    
    // Output on macOS
    0 types with 0 methods in System.Runtime assembly.
    57 types with 701 methods in System.Console assembly.
    103 types with 1,094 methods in System.Linq assembly.
    

    Why does the System.Runtime assembly contain zero types? This assembly is special because it contains only type-forwarders rather than actual types. A type-forwarder represents a type that has been implemented outside of .NET or for some other advanced reason.

  1. Add statements to the top of the file (after importing the namespace) to declare some variables, as shown in the following code:
    using System.Reflection;
    // declare some unused variables using types
    // in additional assemblies
    System.Data.DataSet ds;
    HttpClient client;
    

    By declaring variables that use types in other assemblies, those assemblies are loaded with our application, which allows our code to see all the types and methods in them. The compiler will warn you that you have unused variables, but that won’t stop your code from running.

  1. Run the console app again and view the results, which should look like the following outputs:
    // Output on Windows
    0 types with 0 methods in System.Runtime assembly.
    383 types with 6,854 methods in System.Data.Common assembly.
    456 types with 4,590 methods in System.Net.Http assembly.
    44 types with 645 methods in System.Console assembly.
    106 types with 1,126 methods in System.Linq assembly.
    
    // Output on macOS
    0 types with 0 methods in System.Runtime assembly.
    376 types with 6,763 methods in System.Data.Common assembly.
    522 types with 5,141 methods in System.Net.Http assembly.
    57 types with 701 methods in System.Console assembly.
    103 types with 1,094 methods in System.Linq assembly.
    

Now, you have a better sense of why learning C# is a challenge – because there are so many types and methods to learn. Methods are only one category of a member that a type can have, and you and other programmers are constantly defining new types and members!

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Explore the newest additions to C# 11, the .NET 7 class libraries, and Entity Framework Core 7
  • Create professional websites and services with ASP.NET Core 7 and Blazor
  • Build your confidence with step-by-step code examples and tips for best practices

Description

Extensively revised to accommodate the latest features that come with C# 11 and .NET 7, this latest edition of our guide will get you coding in C# with confidence. You’ll learn object-oriented programming, writing, testing, and debugging functions, implementing interfaces, and inheriting classes. Next, you’ll take on .NET APIs for performing tasks like managing and querying data, working with the filesystem, and serialization. As you progress, you’ll also explore examples of cross-platform projects you can build and deploy, such as websites and services using ASP.NET Core. Instead of distracting you with unnecessary graphical user interface code, the first eleven chapters will teach you about C# language constructs and many of the .NET libraries through simple console applications. Having mastered the basics, you’ll then start building websites, web services, and browser apps. By the end of this book, you’ll be able to create rich web experiences and have a solid grasp of object-oriented programming that you can build upon.

Who is this book for?

This book is primarily for beginners, but intermediate-level C# and .NET programmers who have worked with C# in the past and want to catch up with the changes made in the past few years will also find plenty of useful information in it. Prior exposure to C# or .NET is not a prerequisite, but you should have a general understanding of programming before you jump in. If you already have some C# and .NET skills and want to focus on developing apps, we recommend that you pick up Mark’s other .NET book, Apps and Services with .NET 7, instead.

What you will learn

  • Build rich web experiences using Blazor, Razor Pages, the Model-View-Controller (MVC) pattern, and other features of ASP.NET Core
  • Write, test, and debug functions
  • Query and manipulate data using LINQ
  • Integrate and update databases in your apps using Entity Framework Core models
  • Build and consume powerful services using the latest technologies, including Web API and Minimal API
  • For .NET 6 developers:
  • C# 11 can be used with .NET 6, including features like raw string literals
  • EF Core 7 targets .NET 6, so you can benefit from its new features like ExecuteUpdate and ExecuteDelete for more efficient data modifications
Estimated delivery fee Deliver to South Africa

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$34.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 08, 2022
Length: 818 pages
Edition : 7th
Language : English
ISBN-13 : 9781803237800
Vendor :
Microsoft
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to South Africa

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$34.95
(Includes tracking information)

Product Details

Publication date : Nov 08, 2022
Length: 818 pages
Edition : 7th
Language : English
ISBN-13 : 9781803237800
Vendor :
Microsoft
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 $ 189.97
C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals
$49.99
Apps and Services with .NET 7
$49.99
Solutions Architect's Handbook
$89.99
Total $ 189.97 Stars icon

Table of Contents

18 Chapters
Hello, C#! Welcome, .NET! Chevron down icon Chevron up icon
Speaking C# Chevron down icon Chevron up icon
Controlling Flow, Converting Types, and Handling Exceptions Chevron down icon Chevron up icon
Writing, Debugging, and Testing Functions Chevron down icon Chevron up icon
Building Your Own Types with Object-Oriented Programming Chevron down icon Chevron up icon
Implementing Interfaces and Inheriting Classes Chevron down icon Chevron up icon
Packaging and Distributing .NET Types Chevron down icon Chevron up icon
Working with Common .NET Types Chevron down icon Chevron up icon
Working with Files, Streams, and Serialization Chevron down icon Chevron up icon
Working with Data Using Entity Framework Core Chevron down icon Chevron up icon
Querying and Manipulating Data Using LINQ Chevron down icon Chevron up icon
Introducing Web Development Using ASP.NET Core Chevron down icon Chevron up icon
Building Websites Using ASP.NET Core Razor Pages Chevron down icon Chevron up icon
Building Websites Using the Model-View-Controller Pattern Chevron down icon Chevron up icon
Building and Consuming Web Services Chevron down icon Chevron up icon
Building User Interfaces Using Blazor Chevron down icon Chevron up icon
Epilogue Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1
(54 Ratings)
5 star 63%
4 star 9.3%
3 star 16.7%
2 star 1.9%
1 star 9.3%
Filter icon Filter
Top Reviews

Filter reviews by




Prashant Oct 25, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Each and Every Chapter Contains Tons and Tons On Knowledge.
Subscriber review Packt
Troy Martin Nov 08, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've been a self-taught programmer for the last 5+ years and have read/skimmed countless programming books in my time. I'm well-versed in several languages and recently decided to become more proficient with C# as well as getting caught up to "modern" C# (I learned C# when it was version 7).Mark Price's book is nothing short of a god-send for me. This has been one of the best programming books I've ever read and most certainly the best for the language. While this may not be great for the absolute newbie programmer (it's a very concise book), anyone with a little bit of skill in any language should find themselves right at home. Mark does a wonderful job completely covering not only the fundamentals of the language but also diving into practical applications along with website development and services like ASP.NET, EF Core and more!If you've ever wanted to learn C# (or just programming in general), this is the book I would point anyone to. Mark is an expert in the field and the Discord server for the book has been its own treat with very welcoming and friendly programmers to assist / discuss topics in the book. After finishing this book, you will have all the knowledge you need to develop your own websites and applications with the cross-platform nature that modern C# .NET affords. Get up to speed with the newest C# language features and become confident in your abilities with this book!Note that there is a follow-up book to this one, Apps and Services with .NET 7. I HIGHLY recommend buying the two as a set as the follow-up book directly builds off of what was learned in the 'first book' and includes a recipe-book-like approach to various real-world projects.
Amazon Verified review Amazon
Amazon Customer Jul 28, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I liked the option of getting a PDF version of the book. I liked how rationally layed out the content is and how very complete it is. A really great job!
Amazon Verified review Amazon
William Senn Nov 23, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book is exceptional in that it concentrates on the language and not the IDE. The examples and projects in the first 11 chapters are written as Console applications! This gives the author great flexibility to concentrate on language without concern for UI elements. The vast majority of C# texts out there are either Language References or Windows Form guides, not this one. It is very pragmatically focused. The author starts by giving the reader instructions on installing VS2022 for Windows (works for VS2019 and VS for Mac) as well, VS Code which works on Windows, Linux, Mac, and the SDKs, which also work on Windows, Mac, and Linux. He then delves into how to create multiple projects with the tools. In addition, he walks the user through installing and using .NET Interactive Notebooks (now Polyglot Notebooks) which are basically Jupyter for C# in VS Code - amazing first chapter. With this foundation, the reader is poised to jump into C# and .NET, from C# 8 and.NET Core 3.1 to C# 11 and .NET 7 using nothing more than a command line and text editor, should the reader desire to code that way.After the introductory setup chapter, the author jumps into the language for the next 10 chapters. The last 6 chapters cover the basics of web apps and services... just enough to create working applications and services. The author covers these topics in much greater detail in his other book "Apps and Services with .NET" which, if I have the opportunity to read soon, I very much look forward to.Are there weaknesses? Hmm... sure, but I consider most of what I perceive as weaknesses to be design choices and chalk them up to the author's preferences and style. This is the seventh edition of the text and the author has paid attention to the details.One thing that's noticeable and much appreciated by me is that the author leverages new features of the language expertly and adroitly while calling out there use. This is substantially different from those authors who cut new editions with little effort to embrace what's new.Great book and very helpful approach for readers wanting to learn HOW to program in C# on their ACTUAL computers!
Amazon Verified review Amazon
Rufus Archibald Dec 02, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The material covered was thorough and concise. The examples were good, code was clean and illustrated the topic clearly. Chapters were organized well and in a good sequence to advance the narrative in a logical way. This is a great book to learn from and I highly recommend it for both beginners and seasoned professionals to have around as reference material. It will certainly remain in my library for some time to come.
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 digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

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