ASP.NET Core 2.2 For Beginners (Part 1): Your First ASP.NET Core Application

If you haven’t already installed Visual Studio 2019 version 16.0.0. version or later, you can download a free copy here:

Now that you have Visual Studio 2019 installed on your computer, it’s time to create your first solution and project.

  1. Start Visual Studio 2019 and click the Create a new project button (image below the bullet list).
  2. Select NET Core Web Application in the template list and click the Next button. You can type Web in the search bar to filter the available templates (see image below).
  3. In the Configure your new project dialog:
    1. Name the project AspNetCore22Intro in the Name
    2. Select a folder for the solution in the Location
    3. Name the solution AspNetCore22Intro in the Solution name
    4. Make sure that the Create directory for solution checkbox is checked.
    5. Click the Create
  4. In the project template dialog:
    1. Select.NET Core andNET Core 2.2. in the two drop-downs.
    2. Select Empty in the template list.
    3. Click the OK button in the wizard...
Continue Reading...

The Simple and COOL History of C#


The Simple and COOL History of C#

When .NET Framework was in its cradle the class libraries were created with the Simple Managed C (SMC) managed code compiler. In 1999 a group, led by Anders Hejlsberg, was formed to create a C-like Object Oriented Language that was dubbed COOL. The name was changed to C# for trademark reasons in 2000, by then the class libraries and the ASP.NET run-time had been rewritten with the new C# language.

It didn’t come as a shock to anyone when the creator of the Java language, James Gosling, insisted that C# was a copy of Java with security, reliability and productivity removed. Anders Hejlsberg retorted with that the C# design resembles C++ more than Java.

When C# 2.0 was released in 2005 the two languages went down two very different paths when implementing generics; in C# generics are implemented as first-class generic objects where as in Java generics are more like a language syntax feature.

In 2008 when C# 3.0 was released LINQ extensions was...

Continue Reading...

LINQ - The Take and Skip methods


LINQ - The Take and Skip methods

The partitioning LINQ methods are used to fetch or skip elements from the beginning of an enumerable list while a condition yields true. The Take and Skip methods, and TakeWhile and SkipWhile methods, are complements of one another, meaning that if we concatenate the results from any of these two functional complements we will end up with the same sequence that we started with. These methods are available from .NET Framework 3.5 and onwards.

These are the variations of the four methods that we will be looking at in this article.

  • Take<T>
  • The Take<T> Method with a Nested Query
  • TakeWhile<T>
  • TakeWhile<T> Indexed
  • Skip<T>
  • Skip<T> Nested
  • SkipWhile<T>
  • SkipWhile<T> Indexed

The Take<T> Method

The Take method is used to fetch items from the beginning of an enumerable sequence for as long as the limiting condition is true. The return value is an IEnumerable<T> containing the items satisfying the...

Continue Reading...

LINQ - Join



Sometimes you need to combine values from two data sequences that don’t have a direct relationship connecting them, using LINQ; this is where the join clause comes to the rescue. To be able to connect the two sources it has to be possible to compare equality on a shared value in both sources. For example, a video store clerk wants to match his list of arrived films with a list if film studio that has released films. A join clause could connect these two lists on the film studio id.

When a join clause compares the equality of a single property or a property of an object in the two sources it uses the special equals keyword. All joins made with the join keyword in LINQ are equijoins, which means that equality is used for comparison of the values.

LINQ joins are optimized for equijoins, but you can perform non-equijoins by using multiple from clauses and use a where clause to apply the predicate expression. The predicate expression could call the Contains method on the...

Continue Reading...

Parallel Execution - Loops



Foreach is used to iterate over a collection or an array of objects or values; it can be anything from a simple list of values to a rows in a dataset table.

When using a foreach loop, you don’t have to know the number of elements that the loop will iterate over because it will iterate over all elements in an array or a collection, unless you explicitly end the loop prematurely.

The following code will loop over the animals in the array.

string[] animals = { "cat", "dog", "bird" };

foreach (string animal in animals)


    // Code to execute



A for loop is a way to iterate over a set of values until the given expression evaluates to false. A for loop has three parts: a start value for the loop, an expression telling the loop when to stop, and a counter.

[int i = 0] is the start value, [i < 100] is the condition that makes the loop iterate 100 times, [i++] is the iterator.

for (int i = 0; i < 100; i++)


    // Code to execute a...

Continue Reading...

8 Compelling Reasons to Use LINQ Queries


Language-Integrated Query (LINQ) is a query language that can be used to query a number of data sources. LINQ is built into .NET Languages such as Visual C# and has standardized, declarative query syntax. You can use LINQ to query data sources such as Collections, ADO.NET dataset, SQL Server databases and XML documents; that is any data source that implements the IEnumerable interface.

Using your knowledge of C# and a few keywords and concepts you don’t have to learn an extra language such as SQL or XQuery to query data sources, you can use the following basic syntax in your C# code when querying data sources with LINQ:

from <variable names> in <data source>

group <grouping criteria>

where <selection criteria>

orderby <result ordering criteria>

select <variable name>

Apart from having a standardized syntax for querying data sources LINQ has many other benefits that need to be mentioned. A huge help when writing the code is compile-time...

Continue Reading...

86 - LINQ - Forcing Execution

Continue Reading...

85 - LINQ - Navigate Related Entities

Continue Reading...

84 - LINQ - Group - Aggregate Data


There are many ways to group data in a LINQ query, it is one of the most powerful features of LINQ. You can group by a single property, a substring of a property, a computed numeric range, a Boolean predicate, other expressions and a composite key. You can even nest groups within each other and use them as sub queries.

The information or a subset of the information you group can then be stored using objects of a defined class, or you can use anonymous objects.

The group clause is used to group data; it returns a sequence of IGrouping<TKey, TElement> objects. Items that match the group key value, if any, will be stored in the object sequence. The grouping key can be of any type. Let’s say that you have a sequence of Film objects that you want to group on production year, you could then group the LINQ query on the Year property of the elements, which will make year the grouping key. The data type of the grouping key will be inferred by the compiler and the group clauses...

Continue Reading...

83 - LINQ - Store Data in a New Object

Continue Reading...
1 2 3 4 5 6 7 8 9 10 11

50% Complete

Two Step

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.