dotnet / dotnet/csharpstandard

15.2.7 [was 16.3.1] Add a note to clarify the "merging" aspect of partial classes?

Open
#126 4 comments 0 reactions 0 assignees View on GitHub
type: clarity
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

It's possible that someone reading 16.3.1 might expect the following code to work:

``` csharp
using System;

partial class Test {}
```

(Separate file)

``` csharp
partial class Test
{
static void Main()
{
Console.WriteLine("foo");
}
}
```

If the mental model is that the _source_ code is merged together, then that would be reasonable. I'm aware it doesn't actually work that way, but we should either note explicitly which aspects of partial classes are merged and which aren't, or we should make the wording clearer so that it just becomes obvious naturally.

(This is mentioned in 16.3.9 with an example, by the way...)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.