Skip to content
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

Streamline delegate-typed component parameters #16380

Closed
SteveSandersonMS opened this issue Mar 21, 2018 · 1 comment
Closed

Streamline delegate-typed component parameters #16380

SteveSandersonMS opened this issue Mar 21, 2018 · 1 comment
Assignees
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@SteveSandersonMS
Copy link
Member

As discussed:

  • Stop auto-generation of LHS of lambda
  • Fix the "complex content" errors for cases that should be supported.

End goal: ideally, all of the following should be equivalent for a parameter of type Func<string, int>:

  • <MyComponent Callback="str => str.Length" />
  • <MyComponent Callback="@(str => str.Length)" />
  • <MyComponent Callback=@(str => str.Length) />
  • <MyComponent Callback=@((str) => { return str.Length; }) />
  • <MyComponent Callback=SomeMethod />, given int SomeMethod(string input) => input.Length;
  • <MyComponent Callback=@SomeMethod />, given int SomeMethod(string input) => input.Length;
  • <MyComponent Callback=@(SomeMethod) />, given int SomeMethod(string input) => input.Length;

That's just out of my head, though, and there may be reasons why some subset of these shouldn't be supported (or it's too disruptive to support them in the very short term).

rynowak referenced this issue in dotnet/blazor Mar 21, 2018
This change removes the magic 'auto-lambda' feature that has some
unconvincing UX.

Also working around a razor bug where explicit expressions are lowered
incorrectly. This should make it possible to write code like:

<Foo Bar="@(e => { OnChanged(e); })" />
rynowak referenced this issue in dotnet/blazor Mar 21, 2018
This change removes the magic 'auto-lambda' feature that has some
unconvincing UX.

Also working around a razor bug where explicit expressions are lowered
incorrectly. This should make it possible to write code like:

<Foo Bar="@(e => { OnChanged(e); })" />
SteveSandersonMS referenced this issue in dotnet/blazor Mar 21, 2018
This change removes the magic 'auto-lambda' feature that has some
unconvincing UX.

Also working around a razor bug where explicit expressions are lowered
incorrectly. This should make it possible to write code like:

<Foo Bar="@(e => { OnChanged(e); })" />
@SteveSandersonMS
Copy link
Member Author

Fixed in dotnet/blazor#321

SteveSandersonMS referenced this issue in SteveSandersonMS/BlazorMigration Nov 27, 2018
This change removes the magic 'auto-lambda' feature that has some
unconvincing UX.

Also working around a razor bug where explicit expressions are lowered
incorrectly. This should make it possible to write code like:

<Foo Bar="@(e => { OnChanged(e); })" />
@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/blazor Oct 27, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Oct 27, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

3 participants