dotnet / dotnet/csharplang

[Proposal]: Top-level members

Open
#9,803 0 comments 0 reactions 1 assignee Claimed by @jaredpar View on GitHub
Proposal Proposal champion
Dominant language
C#
Stars
12.7k
Forks
1.1k
Avg merge
11h 1m
Merged PRs (30d)
3

Description

# Top-level members

* Specification: https://github.com/dotnet/csharplang/blob/main/proposals/top-level-members.md
* Discussion: https://github.com/dotnet/csharplang/discussions/9802

## Summary

Allow some members (methods, operators, extension blocks, and fields) to be declared in namespaces
and make them available when the corresponding namespace is imported.

```cs
// util.cs
namespace MyApp;

void Print(string s) => Console.WriteLine(s);

string Capitalize(this string input) =>
input.Length == 0 ? input : char.ToUpper(input[0]) + input[1..];
```

## Design meetings

- [LDM 2025-08-18](https://github.com/dotnet/csharplang/blob/c85bbf501958fa86ee2db94b14c82ee8fd2066b9/meetings/2025/LDM-2025-08-18.md?plain=1#L72)
- https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-12-17.md#top-level-members

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.