100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
.NET

.NET Core Quick Reference

A condensed reference covering essential dotnet CLI commands, LINQ/collection quick facts, and configuration patterns for everyday .NET Core development.

Practical .NET CoreBeginner7 min readJul 10, 2026
Analogies

Essential dotnet CLI Commands and Project Structure

Every .NET Core project starts from the CLI: dotnet new webapi -n MyApi scaffolds a new Web API project, dotnet run compiles and launches it, dotnet add package <Name> adds a NuGet dependency to the nearest .csproj, and dotnet ef migrations add <Name> (with the EF Core tools installed) generates a database migration. A typical project's structure separates Program.cs (the composition root and minimal API/middleware pipeline), appsettings.json (configuration), and folders like Controllers/, Models/, and Services/ that map cleanly onto the layers of a typical web application.

🏏

Cricket analogy: dotnet new webapi -n MyApi is like a franchise announcing a brand-new team with one command — instantly provisioning a stadium, kit, and starting eleven template ready to be customized.

Collections and LINQ Quick Facts

LINQ methods like .Where(), .Select(), and .OrderBy() on an IEnumerable<T> are deferred/lazy — the query doesn't execute until you enumerate it (via foreach, .ToList(), or .Count()), which means a query built from a stale data source can return different results if the source changes before enumeration. List<T> offers O(1) index access and O(1) amortized Add, while Dictionary<TKey,TValue> offers average O(1) lookup by key; picking the wrong collection (e.g., List<T>.Contains() for frequent membership checks, which is O(n)) is a common source of accidental quadratic-time bugs in code that looks innocent at a glance.

🏏

Cricket analogy: Deferred LINQ execution is like a bowling analysis that isn't calculated until the over actually finishes — the numbers reflect whatever deliveries were actually bowled at query time, not when you first set up the stat.

Configuration and appsettings Patterns

IConfiguration in ASP.NET Core reads from a layered set of sources — appsettings.json, then appsettings.{Environment}.json, then environment variables, then command-line arguments — with later sources overriding earlier ones, so a value set via an environment variable in production always wins over what's in the checked-in JSON file. The strongly-typed options pattern binds a JSON section to a POCO class via builder.Services.Configure<MySettings>(builder.Configuration.GetSection("MySettings")), then that class is injected as IOptions<MySettings> (or IOptionsSnapshot<T> for per-request reload) instead of scattering configuration["MySettings:Key"] magic strings throughout the codebase.

🏏

Cricket analogy: Layered configuration sources overriding each other is like a match's playing conditions being set by the ICC rulebook by default, then overridden by ground-specific regulations, then finally overridden by an on-field umpire's decision on the day.

csharp
// Strongly-typed options pattern
public class MySettings
{
    public string ApiKey { get; set; } = string.Empty;
    public int TimeoutSeconds { get; set; } = 30;
}

builder.Services.Configure<MySettings>(
    builder.Configuration.GetSection("MySettings"));

app.MapGet("/config-check", (IOptions<MySettings> options) =>
    Results.Ok(new { options.Value.TimeoutSeconds }));

// Deferred LINQ example
var names = new List<string> { "Asha", "Rahul", "Meera" };
IEnumerable<string> query = names.Where(n => n.StartsWith('A')); // not executed yet
names.Add("Aditya");
var result = query.ToList(); // now includes "Aditya" too

Quick CLI cheat sheet: dotnet new list (see available templates), dotnet restore, dotnet build, dotnet test, dotnet run, dotnet publish -c Release, dotnet add package <Name>, dotnet add reference <path>, dotnet ef migrations add <Name>, dotnet ef database update, dotnet tool install --global <ToolName>.

Calling .ToList() too early on a LINQ query forces immediate evaluation, which is usually fine, but calling it too late — inside a loop that re-enumerates a deferred query built from a changing source — can silently produce inconsistent results. Always be intentional about when a query materializes.

  • dotnet new, restore, build, test, run, and publish are the core CLI verbs for everyday development.
  • LINQ queries on IEnumerable<T> are deferred until enumerated via foreach, ToList(), or Count().
  • Dictionary<TKey,TValue> gives average O(1) key lookup versus List<T>.Contains()'s O(n) scan.
  • IConfiguration layers appsettings.json, environment-specific JSON, environment variables, and CLI args in that override order.
  • The strongly-typed options pattern binds a config section to a POCO via Configure<T> and IOptions<T>.
  • IOptionsSnapshot<T> supports per-request reload of configuration values, unlike IOptions<T>.
  • Use dotnet ef migrations add and dotnet ef database update to manage EF Core schema changes.

Practice what you learned

Was this page helpful?

Topics covered

#NET#NETCoreStudyNotes#MicrosoftTechnologies#NETCoreQuickReference#Core#Quick#Reference#Essential#StudyNotes#SkillVeris