dotnet / dotnet/docs

Why are examples overly complicated?

Open
#28,330 1 comment 0 reactions 0 assignees View on GitHub
dotnet-csharp/svc fundamentals/subsvc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

This is one of many instances where the principle being explained is lost in an unnecessarily complicated code example. In this case, we want to show "How to raise base class events in derived classes", as the title says. All you need for this is a base class with a function that invokes the event, and the derived class that calls that function. That's it, no need for custom EventArgs, multiple derived classes and a contrived example of how to use the derived class, all that stuff just gets in the way.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 48effe00-bf69-be72-bb9b-b343702de37b
* Version Independent ID: bd6b5366-556a-76e6-4ccd-e06ddaff1cd1
* Content: [How to raise base class events in derived classes - C# Programming Guide](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/events/how-to-raise-base-class-events-in-derived-classes)
* Content Source: [docs/csharp/programming-guide/events/how-to-raise-base-class-events-in-derived-classes.md](https://github.com/dotnet/docs/blob/main/docs/csharp/programming-guide/events/how-to-raise-base-class-events-in-derived-classes.md)
* Product: **dotnet-csharp**
* Technology: **csharp-fundamentals**
* GitHub Login: @BillWagner
* Microsoft Alias: **wiwagn**

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.