惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
IT之家
IT之家
Last Week in AI
Last Week in AI
J
Java Code Geeks
L
LangChain Blog
Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
博客园 - Franky
博客园 - 司徒正美
月光博客
月光博客
博客园 - 叶小钗
Vercel News
Vercel News
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
B
Blog RSS Feed
人人都是产品经理
人人都是产品经理
H
Help Net Security
G
Google Developers Blog
D
DataBreaches.Net

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
7 overlooked .Net features
Sergey Shamo · 2026-05-21 · via DEV Community

.Net is constantly evolving, a new version comes out every year, and it's easy to lose track of some of the useful changes.
I compiled a list of 7 (mostly) recent features that I from my code reviews I think get overlooked by devs (or devs' AI tools).

1. Extension Members (C# 14)

In addition to extension methods, we can now add extension properties and static methods to a type.
Properties are mostly just for readability, and static extension methods are useful for writing factory methods instead of creating a separate factory class.

So instead of

public static class CustomerExtensions
{
    public static bool IsPayingCustomer(this Customer customer)
    {
        return customer.TotalSpent > 0;
    }
}

Enter fullscreen mode Exit fullscreen mode

we can write

public implicit extension CustomerExtensions for Customer
{
    // Add a property to a class you don't control
    public bool IsPayingCustomer => this.TotalSpent > 0;

    // Add a static method
    public static Customer Parse(string json) 
        => JsonSerializer.Deserialize<Customer>(json);
}

Enter fullscreen mode Exit fullscreen mode

No state or memory, just syntactic sugar for better readability. In the background the property is still an extension method.

var customer = Customer.Parse("{\"TotalSpent\": 100}");

var oldMethod = customer.IsPayingCustomer();

var newProperty = customer.IsPayingCustomer;

Enter fullscreen mode Exit fullscreen mode


2. The field keyword (C# 14)

It isn't required anymore to define a backing field to have some logic in getter/setter.
Just use the field keyword (be careful not to name anything 'field' in the class) and get the implicit backing field.

public string Name
{
    get => field;
    set => field = value?.Trim();
}

Enter fullscreen mode Exit fullscreen mode


3. File-based apps (.NET 10)

Do you have a console solution (or several) just for various small tools?
Now instead we can just run a single .cs file with dotnet run mytool.cs, without the need for any .sln or .csproj.
Write your single file like

// Add nuget packages with the special syntax
#:package Newtonsoft.Json@13.0.3

// Still need to add using statements
using Newtonsoft.Json;  

// Access command line arguments
var allArgs = Environment.GetCommandLineArgs();

Enter fullscreen mode Exit fullscreen mode


4. OrderedDictionary<TKey, TValue> (.NET 9)

We now have a kind of a named list in shape of OrderedDictionary<TKey, TValue>.
The elements can be both accessed by key and by index.

var laundryRoom = rooms[17];

var diningRoom = rooms["dining"];

Enter fullscreen mode Exit fullscreen mode

The order of elements is the order of insertion, so 0 is the first inserted element.


5. Enumerable.Index() (.NET 9)

A tiny but sweet sugar: instead of writing a for loop

for (int i = 0; i < items.Count; i++)
{
    var item = items[i];
    // act
}

Enter fullscreen mode Exit fullscreen mode

we can use foreach with IEnumerable and still get the index variable:

foreach (var (index, item) in items.Index())
{
    // act
}

Enter fullscreen mode Exit fullscreen mode


6. CountBy and AggregateBy LINQ (.NET 9)

Another sweet addition:

// old count of items by status
var countByStatus = items.GroupBy(x => x.Status)
    .Select(g => new { g.Key, Count = g.Count() });

// new
var countByStatus = items.CountBy(x => x.Status);

Enter fullscreen mode Exit fullscreen mode

// old sum of amounts by status
var aggregateByStatus = items.GroupBy(x => x.Status)
    .Select(g => new { g.Key, Sum = g.Sum(x => x.Amount) });

// new
var aggregateByStatus = items.AggregateBy(
    x => x.Status,              // Key selector
    seed: 0m,                   // Initial value
    (sum, x) => sum + x.Amount  // Aggregation logic
);

Enter fullscreen mode Exit fullscreen mode

Apart from just being more readable, these methods skip the intermediate grouping allocation.


7. CompareOptions.NumericOrdering (.NET 9)

Finally we can sort string and have "file2" come before "file10", thanks to CompareOptions.NumericOrdering:

var sorted = myStrings.OrderBy(s => s,
    StringComparer.Create(CultureInfo.InvariantCulture, 
        CompareOptions.NumericOrdering));

Enter fullscreen mode Exit fullscreen mode


That's my list. Do you know other features people should use more often?