Handler code wrapped in @(...)?
See original GitHub issueIn the second step, the event handler code is wrapped in an additional @(...)
construct:
@onclick="@(() => Console.WriteLine(special.Name))"
Can you explain why? It seems to work without problems with just
@onclick="() => Console.WriteLine(special.Name))"
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Wrap the event handler in JQuery - javascript
It means I'd like to wrap the current event handlers with some extra codes. I'd like to call the old code with setTimeOut()...
Read more >Attribute::Handlers to wrap a function
The Wrap function is marked to be a attribute handler for subroutines (CODE). Inside we create a new anonymous subroutine and assign it...
Read more >Wrap Your Lambda Handler in Code
For Python and Node.js Lambda functions, in order to instrument individual invocations, the Datadog Lambda library needs to wrap around your Lambda handler...
Read more >io.undertow.server.HandlerWrapper.wrap java code ...
Best Java code snippets using io.undertow.server.HandlerWrapper.wrap (Showing top 20 results out of 315) · Popular methods of HandlerWrapper · Popular in Java.
Read more >JavaScript for C# programmers: wrapping an existing function ...
My solution to the problem involved adding some extra precondition code to an existing event handler. The event was the plotclick event of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lohithgn To me, the current examples are not consistent though in there use of parentheses:
Without parentheses:
<span class="topping-price">@topping.Topping.GetFormattedPrice()</span>
With parentheses:
Price: <span class="price">@(Pizza.GetFormattedTotalPrice())</span>
With and without?
<div class="title">@(Pizza.Size)" @Pizza.Special.Name</div>
When you say opt for explicit razor expressions, what are your guidelines for using them?
@jessegood I see. Let me try to explain again. Basically, I would prefer implicit expressions over explicit unless the parser requires them. So in the example that you copied from my question, I would make it:
<span class="price">@Pizza.GetFormattedTotalPrice()</span>
and not<span class="price">@(Pizza.GetFormattedTotalPrice())</span>
My question was why prefer the latter over the former, as it doesn’t make the code easier to understand.