Closed FreeApophis closed 2 years ago
Razor files generate C# code, which is then analyzed by our analyzer. We should probably be able to detect where the generated source comes from?
On another note, we might also be able to provide some convenience for directly inserting Option
values into the document. \
@expression
translates to a call to RenderTreeBuilder.AddContent(index, value)
I think it should be possible to extend this with extension methods for Option
values.
With that approach it should even be possible to do:
@option.Select<RenderFragment>(value => @<div>@value</div>);
Sadly my approach with the extension method doesn't work because the built-in overload with object
always wins against my extension method.
TryGetValue
it is then :)
Example:
The alternatives are pretty bleak, because Select or AndThen are not really usable.