Ecosystem
Ecosystem & Tooling
Introduction
In this lesson, you'll learn about ecosystem in C#. Coming from TypeScript, you already have a foundation for understanding this concept. We'll build on that knowledge while highlighting the key differences.
In TypeScript, you're familiar with ecosystem & tooling.
C# has its own approach to ecosystem & tooling, which we'll explore step by step.
The C# Way
Let's see how C# handles this concept. Here's a typical example:
// NuGet / .csproj
// dotnet add package Newtonsoft.Json
using System.Text.Json;
// Built-in HttpClient
var client = new HttpClient();
var json = await client.GetStringAsync("/api/user");
var user = JsonSerializer.Deserialize<User>(json);
// Built-in validation via DataAnnotations
// No zod needed — use FluentValidation for complex rules
// Testing: xUnit + FluentAssertions
[Fact]
public void AddReturnsSum() {
Add(1, 2).Should().Be(3);
}Comparing to TypeScript
Here's how you might have written similar code in TypeScript:
// npm / package.json
// npm install axios zod jest
import axios from "axios";
import { z } from "zod";
const UserSchema = z.object({
id: z.number(),
name: z.string(),
});
const user = UserSchema.parse(await axios.get("/api/user"));You may be used to different syntax or behavior.
npm → NuGet (package manager), packages listed in .csproj
You may be used to different syntax or behavior.
.NET SDK includes many batteries: HttpClient, JSON, logging, DI
You may be used to different syntax or behavior.
No external schema validation library needed — DataAnnotations is built-in
You may be used to different syntax or behavior.
TypeScript runs on Node.js; C# runs on .NET (cross-platform, Windows/Linux/macOS)
Step-by-Step Breakdown
1. NuGet = npm
NuGet is the .NET package manager. Use dotnet add package <name> or edit .csproj. Packages are hosted on nuget.org (equivalent of npmjs.com).
npm install axiosdotnet add package RestSharp
// or edit .csproj:
<PackageReference Include="RestSharp" Version="110.2.0" />2. .NET Batteries Included
.NET includes HttpClient, System.Text.Json, dependency injection, and logging in the standard library. You need fewer third-party packages than in Node.js.
import axios from "axios"; // third-party
import express from "express"; // third-party// Built-in:
using System.Net.Http; // HttpClient
using System.Text.Json; // JSON
// ASP.NET Core is part of .NET SDK3. dotnet CLI = npx/tsc/node
The dotnet CLI handles building, running, testing, and publishing. It replaces tsc, node, npm scripts, and jest in one tool.
tsc && node dist/index.js
npm test
npm run builddotnet run # build + run
dotnet test # run tests
dotnet publish # production build4. .NET Use Cases
.NET is dominant in enterprise Windows environments, ASP.NET APIs, game development (Unity uses C#), cloud services on Azure, and cross-platform desktop apps (MAUI).
// TypeScript: web front-end, Node APIs, serverless, CLIs// C# .NET: enterprise APIs, cloud (Azure),
// Unity games, Windows desktop (WPF/MAUI),
// cross-platform microservicesCommon Mistakes
When coming from TypeScript, developers often make these mistakes:
- npm → NuGet (package manager), packages listed in .csproj
- .NET SDK includes many batteries: HttpClient, JSON, logging, DI
- No external schema validation library needed — DataAnnotations is built-in
Key Takeaways
- NuGet (nuget.org) is the .NET equivalent of npm — use dotnet add package
- .NET SDK includes HttpClient, JSON, DI, and logging — fewer third-party deps needed
- dotnet CLI replaces tsc, node, npm scripts, and jest in one tool
- C# dominates enterprise, Azure cloud, Unity games, and Windows desktop development