Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`this()` is not necessary since C#11

Open Beginner friendly
#56,405 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
documentation

Research direction

The example is in docs/csharp/modern-events.md, in the SearchDirectoryArgs struct, where the constructor ends with : this(). Remove that initializer and check the prose just above or below it, which says this() is needed to avoid the unassigned-property error; that sentence needs rewording or removal too. Done when the example compiles as written under C# 11 and the explanation matches it.

Written by the indexing model from the issue text.

Description

:watch: Not Triaged dotnet-csharp/svc fundamentals/subsvc
Type of issue

Typo

Description

The code example of struct SearchDirectoryArgs has an example constructor internal SearchDirectoryArgs(string dir, int totalDirs, int completedDirs) : this() . The text explains that calling this() because Without that addition, the rules of C# would report that the properties are being accessed before being assigned..

The reason is not true since C#11. The compiler automatically zero-initializes any fields you don't assign in a constructor. I suggest we remove this() because all 3 properties are initialized and this is a beginner-friendly document:)

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/modern-events

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/modern-events.md

Document Version Independent Id

645a8a12-a026-bee9-7501-e8ec4a32ce31

Platform Id

9c865adf-6af0-1f7e-0fcb-510d233d5680

Article author

@BillWagner

Metadata
  • ID: 2cb74e28-b327-0f9f-5fa5-882a00d10ceb
  • PlatformId: 9c865adf-6af0-1f7e-0fcb-510d233d5680
  • Service: dotnet-csharp
  • Sub-service: fundamentals

Related Issues

Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
14h 12m
Merged PRs (30d)
312

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/docs

All issues in dotnet/docs

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.