Skip to content

Fix delegate types in manual README examples - #556

Open
dajiaohuang wants to merge 1 commit into
dadhi:masterfrom
dajiaohuang:docs/typed-manual-lambda-examples-20261015
Open

dajiaohuang wants to merge 1 commit into
dadhi:masterfrom
dajiaohuang:docs/typed-manual-lambda-examples-20261015

Conversation

@dajiaohuang

Copy link
Copy Markdown

Problem

Both manually composed examples in How to use create a non-generic LambdaExpression, then call CompileFast() and invoke the inferred result as f(new B()). The non-generic overload returns Delegate, so copying either example fails with compiler error CS0149 (Method name expected).

Change

Specify CompileFast<Func<B, X>>() in both examples, matching the existing ManuallyComposedExprTests.Should_compile_manually_composed_expr_with_parameters usage. No API or behavior changes.

Validation

  • Reproduced CS0149 with the original example and simple A/B/X types plus the constructor declaration.
  • Both corrected README snippets compiled and ran against NuGet 6.0.0 on .NET 10, using both System.Linq.Expressions and the documented LightExpression alternative (four cases). Checked that the constructed X retains the original A and supplied B.
  • Corrected example also passed against the current source project.
  • No full library test matrix run for this documentation-only change.

@dadhi

dadhi commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Thanks for finding - but the fixes should go into the Expression.Lambda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants