/net10-core:csharp-14from net10-core
Use when writing or reviewing C# in a project that targets net10.0 (C# 14 by default), or when choosing LangVersion: extension members/extension blocks, extension properties, the `field` keyword, null-conditional assignment, partial constructors/events, user-defined compound assignment operators, first-class span conversions, and modeling a closed set of cases ("discriminated union", "one of several types", exhaustive switch) without C# 15 unions. USE FOR: "extension property", "extension block", "static extension", "field keyword", "backing field", "?.= assignment", "union type", "closed hierarchy", "OneOf", "exhaustive switch", "CS8509", "CS9258", "LangVersion latest", "LangVersion preview", "C# 15". DO NOT USE FOR: projects targeting net11.0 or later (C# 15 unions and closed classes are real there), F# discriminated unions, or behavior-preserving refactors (use csharp-refactoring).
Ships in net10-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
net10.0 defaults to C# 14. C# 15 (unions, closed, collection-expression arguments, extension
indexers, labeled break/continue) needs .NET 11 runtime types and the .NET 11 compiler. Models that saw
C# 15 previews write it into .NET 10 projects; models trained earlier miss C# 14 features entirely.
TargetFramework is net10.0 and LangVersion is absent or 14.0. If you find latest, default,
latestMajor or preview, say so: on a machine with a .NET 11 SDK they switch to C# 15 for a net10.0
project, which is unsupported and breaks builds that pass elsewhere. Pin the SDK in global.json.LangVersion/TargetFramework to make a feature compile, and do not add <WarningsAsErrors>
to the project unless asked.| Feature | Syntax |
|---|---|
| Extension block | public static class E { extension<T>(IEnumerable<T> source) { public bool IsEmpty => !source.Any(); } } — container must be a top-level, non-generic static class |
| Static extension member | extension<T>(IEnumerable<T>) { public static IEnumerable<T> None => []; } → IEnumerable<int>.None (receiver unnamed) |
| Extension operators | allowed in extension blocks; indexers, fields, events, constructors are not (CS9282) |
field keyword | public string Email { get; set => field = value.Trim(); } |
| Null-conditional assignment | customer?.Address?.City = city; also +=; right side evaluated only if receiver non-null. Not ++/-- (CS1059), not on nullable structs |
Unbound nameof | nameof(List<>) → "List" |
| Lambda modifiers without types | TryParse<int> p = (text, out result) => int.TryParse(text, out result); (params still needs types) |
| Partial constructors / events | public partial Generated(string name); + implementing part; same for partial event |
| Compound assignment operators | public void operator +=(int x) and public void operator ++() (instance, void, public) |
| Spans | arrays and strings convert implicitly to Span<T>/ReadOnlySpan<T> |
Compiled examples: examples/ExtensionMembers.cs, examples/FieldKeyword.cs, examples/SmallFeatures.cs, examples/PaymentMethod.cs.
C# 14 cannot prove a class hierarchy is complete, so a switch over subclasses always needs a discard arm
(CS8509 otherwise). When the task asks for "exactly one of A, B, C" with compiler help on new cases:
abstract record PaymentMethod with a private constructor and nested sealed record cases — nobody
outside can add a case.Match<TResult>(Func<A,TResult> a, Func<B,TResult> b, Func<C,TResult> c) that each case
overrides. Adding a case adds a parameter, and every caller stops compiling until it handles it.switch instead, end with _ => throw new UnreachableException(...).Do not use a parallel Kind enum for exhaustiveness (a new subclass without a new enum member goes unnoticed),
and do not add OneOf-style packages for this. Full code: examples/PaymentMethod.cs.
field inside a property accessor now means the synthesized backing field: silent
behavior change with only warning CS9258. Use this.field / @field or rename. A local named field
in an accessor is error CS9273.Expression<>, array.Contains(x) binds to
MemoryExtensions.Contains and interpreted compilation throws; use Enumerable.Contains(array, x).
Covariant arrays (object[] o = new string[1]) passed where a Span<T> overload exists throw
ArrayTypeMismatchException; call .AsEnumerable().net8.0;net10.0) must not force C# 14 on the older targets: array.Reverse()
then binds the in-place Span overload (returns void).extension and field are contextual keywords: types/aliases named extension → CS9306; escape with @.nameof(this.P) inside attributes (10.0.1xx accepts it). Write nameof(P).| C# 15 | Error on SDK 10.0.1xx | C# 14 instead |
|---|---|---|
public union Pet(Cat, Dog);, [Union], IUnion | CS1001 / CS8803 (types absent from net10.0) | closed record hierarchy + Match (above) |
closed class/record | CS1585 / CS1002 | abstract record + private constructor |
[with(capacity: 10), 1, 2] collection arguments | CS0103 'with' does not exist | new List<int>(10) { 1, 2 } |
extension indexers this[int i] in an extension block | CS9282 | an extension method ElementAtOrDefault(...) |
break outer; / continue outer; | CS1002 | extract a method and return, or goto |
LangVersion=15.0 | CS1617 | omit LangVersion |
| closed enums | proposal only, not in any C# version | enum + _ => throw |
The error depends on the SDK band that builds the project, but it fails on every one:
SDK 10.0.1xx gives the parse errors above; newer 10.0 bands (10.0.4xx) give CS8652 "currently in Preview and
unsupported. ... use the 'preview' language version"; a .NET 11 SDK gives CS9327 "not available in C# 14.0".
Never answer CS8652/CS9327 by setting LangVersion to preview/15: some C# 15 syntax then compiles on that one
machine and breaks on every other one (and closed/union still fail: net10.0 lacks IsClosedTypeAttribute/UnionAttribute).
Detail (every feature rule, every .NET 10 compiler breaking change, LangVersion semantics): references/csharp-14-reference.md.
csharp-refactoring (Microsoft): safe, behavior-preserving refactors (uses the C# LSP when present).dotnet-breaking-changes (Microsoft): look up a breaking change by version or diagnostic.migrate-nullable-references (Microsoft): enabling NRT.csharp-concurrency-patterns (community): async/await, channels, locking.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub codehepta/net10-skills --plugin net10-core11 skills in this plugin
/csharp-concurrency-patternsChoosing the right concurrency abstraction in .NET - from async/await for I/O to Channels for producer/consumer to Akka.NET for stateful entity management. Avoid locks and manual synchronization unless absolutely necessary./csharp-refactoringSafely refactors C#/.NET code without changing behavior. USE FOR any request to refactor, rename, move, extract, inline, merge, consolidate, deduplicate, split, or modernize C# code, even a small extract, inline, or rename, or merging near-identical types; green builds miss drift in #if branches, generated partials, and reflection/config names. When a changed member is visible outside the assembly (PublicAPI.*.txt, InternalsVisibleTo, shipped package), also invoke dotnet-breaking-changes; local/private renames do not need it. Also use when a request calls a feature, bug fix, package/framework upgrade, or public nullability change a refactor and the behavior-changing part must be separated or declined. DO NOT USE FOR ordinary feature or bug fixes not presented as refactoring; standalone upgrades after reclassification (use dotnet-upgrade); adding tests; or formatting-only work./csharp-scriptsRun file-based C# apps with the .NET CLI when the user explicitly wants C#/.NET code without creating a project. Use for C# language/API experiments, one-file C# apps, small multi-file C# apps composed with `#:include`/`#:exclude`, or C# file-based apps linked with `#:ref`. Do not use for language-agnostic throwaway scripts, generic computations, Python/PowerShell-style automation, full projects, or existing app integration.Other plugins' skills for the same job