Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 1, 2025

The "Working with LINQ" tutorial was missing explicit guidance about namespace requirements when creating the Extensions.cs file, causing compilation errors for users following the tutorial outside of Visual Studio.

Problem

When users follow the tutorial and create the Extensions.cs file with the LinqFaroShuffle namespace, extension methods like InterleaveSequenceWith are not accessible in Program.cs without a proper using statement. This works automatically in Visual Studio, but fails in other editors like Visual Studio Code.

Solution

Added two targeted clarifications to the tutorial:

  1. Early guidance (after initial using statements): Added a tip explaining namespace organization options
  2. Specific guidance (after Extensions.cs code): Added a note explaining when the using LinqFaroShuffle; statement is needed

Testing

Verified both approaches work correctly:

// Approach 1: Using statement (for top-level programs)
using System;
using System.Collections.Generic;
using System.Linq;
using LinqFaroShuffle;  // This line needed for extension methods

// Approach 2: Same namespace (traditional structure)
namespace LinqFaroShuffle
{
    public class Program { /* ... */ }
}

The changes are minimal and surgical - only adding clarifying notes without modifying any existing code or breaking changes.

Fixes #18562.


💡 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.


Internal previews

📄 File 🔗 Preview link
docs/csharp/tutorials/working-with-linq.md docs/csharp/tutorials/working-with-linq

Copilot AI changed the title [WIP] Program.cs snippets missing using statement for extension methods Add using statement guidance for extension methods in LINQ tutorial Jul 1, 2025
Copilot AI requested a review from BillWagner July 1, 2025 18:13
Copilot finished work on behalf of BillWagner July 1, 2025 18:13
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. I'll mark it ready for final review.

@BillWagner BillWagner marked this pull request as ready for review July 2, 2025 13:27
@BillWagner BillWagner requested a review from a team as a code owner July 2, 2025 13:27
@BillWagner BillWagner requested a review from IEvangelist July 2, 2025 13:27
Copilot AI requested a review from IEvangelist July 2, 2025 14:18
Copilot finished work on behalf of IEvangelist July 2, 2025 14:18
@BillWagner BillWagner enabled auto-merge (squash) July 2, 2025 14:28
@BillWagner BillWagner merged commit a910d3f into main Jul 2, 2025
10 checks passed
@BillWagner BillWagner deleted the copilot/fix-18562 branch July 2, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Program.cs snippets missing using statement for extension methods

3 participants