CKTIS / C#
partial: practical reference
partial: practical reference: partial merges declarations within the same compilation, even in one file: types and methods, plus properties and indexers from C# 13 and instance constructors and events from C# 14.
Version: C# language; verified against C# 14 reference
Syntax
partial /* grammar-specific form */partial merges declarations within the same compilation, even in one file: types and methods, plus properties and indexers from C# 13 and instance constructors and events from C# 14.
Use it for generated code and handwritten extensions without editing the generator.
Every part must agree on kind, generic parameters, and accessibility.
It does not create multiple runtime types; conflicting members are compilation errors.
The complete program actually uses partial; its exact expected stdout is 4.
Examples
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
Console.WriteLine(new Split().Read());
partial class Split { public int Read() => 4; } partial class Split { }
Result
4
The complete program actually uses `partial`; its exact expected stdout is `4`.