Skip to content

Improve delegate documentation clarity and beginner-friendliness #47136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 8, 2025

Fixes #25566

Problem

The delegate documentation in docs/csharp/delegate-class.md was confusing for readers, as reported in the original issue:

  • Introduced concepts "in a kind of backwards way"
  • Made assumptions about prior knowledge
  • Used overly terse, technical language
  • Was "difficult to grasp" and caused readers to "stop reading"

Solution

Completely rewrote the documentation to be more beginner-friendly while maintaining technical accuracy:

Key Improvements

  1. Added conceptual introduction: New "What are delegates?" section explains the concept with relatable analogies before diving into syntax
  2. Progressive concept building: Starts with simple examples before complex ones
  3. Better flow: Explains "why" before "how" throughout the document
  4. Conversational tone: Rewrote technical explanations to be more accessible
  5. Improved examples: Added simple Calculator delegate example before the complex List.Sort example

Before/After Comparison

Before:

Let's start with the 'delegate' keyword, because that's primarily what
you will use as you work with delegates. The code that the
compiler generates when you use the `delegate` keyword will
map to method calls that invoke members of the System.Delegate
and System.MulticastDelegate classes.

After:

## What are delegates?

Think of a delegate as a way to store a reference to a method, similar to how you might store a reference to an object. Just as you can pass objects to methods, you can pass method references using delegates. This is incredibly useful when you want to write flexible code where different methods can be "plugged in" to provide different behaviors.

For example, imagine you have a calculator that can perform operations on two numbers...

Structure Changes

  • Conceptual before technical: Now starts with "What are delegates?" before syntax
  • Simple before complex: Calculator example before List.Sort
  • Progressive explanations: Each section builds on the previous one
  • Better transitions: Added connecting sentences between concepts

The documentation now follows a logical progression: concept → simple example → practical example → implementation details, making it much more accessible to developers learning about delegates while preserving all technical accuracy.

Validation

  • ✅ Passes markdownlint validation
  • ✅ Maintains all existing technical content and cross-references
  • ✅ Follows Microsoft Writing Style Guide conventions
  • ✅ Uses active voice and conversational tone as specified in style guidelines

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@BillWagner
Copy link
Member

@copilot Please start working on this again

@BillWagner
Copy link
Member

@copilot Can you start working on this again?

@BillWagner
Copy link
Member

@copilot Can you start working on this again?

…ptual

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Confusing introduction to delegates Improve delegate documentation clarity and beginner-friendliness Jul 10, 2025
Copilot finished work on behalf of BillWagner July 10, 2025 20:34
@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-csharp/svc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing introduction to delegates
2 participants