Support optional input for MapAction#30434
Conversation
|
Ping @halter73! |
I'm not sure we want to do this. This will result in LOTS of allocations (see #30390). |
What if the |
|
We're going to make it cheap but not as part of this PR. We also don't pass the token anywhere except when doing big IO transfers (like copying files) so I'd leave it for now |
| } | ||
|
|
||
| void TestAction([FromRoute] int value) | ||
| public static IEnumerable<object[]> FromRouteOptionalResult |
There was a problem hiding this comment.
Nit: Any particular reason for using local functions for FromRouteResult but not FromRouteOptionalResult?
There was a problem hiding this comment.
It looks like local functions are not generating the optional parameter and handles then in compile time.
According to Sharplab.io, this code:
public void M()
{
Test();
void Test(int a = 2)
{
}
}will be compiled to this:
public void M()
{
<M>g__Test|0_0(2);
}
[CompilerGenerated]
internal static void <M>g__Test|0_0(int a)
{
}Perhaps this is another feature that could be asked from C# team?
There was a problem hiding this comment.
Issue filed: dotnet/roslyn#51518
I also requested that lambdas add support for optional parameters as part of the C# 10 lambda improvements: dotnet/csharplang#4451 (comment)
|
Hello @halter73! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
ValueTaskoutputPassHttpContext.RequestAbortedtoWriteAsJsonAsync(),WriteAsync(),ReadFromJsonAsync(),ReadFormAsync()Addresses #30248