gpt4 book ai didi

blazor - Blazor 中的级联 @typeparam

转载 作者:行者123 更新时间:2023-12-02 02:08:50 25 4
gpt4 key购买 nike

你能以某种方式级联@typeparam吗?

例如在这种情况下,将 TItem 传递给 Child 而不指定它

预期行为:

<Parent TItem="User">
<Child>
</Parent>

当前:

<Parent TItem="User">
<Child TItem="User">
</Parent>

最佳答案

还没有,但应该是coming with .NET 6 .

来自文档:

In .NET 6 Preview 2, Blazor can now infer generic type parameters from ancestor components. Ancestor components must opt in to this behavior. An ancestor component can cascade a type parameter by name to descendants using the [CascadingTypeParameter] attribute. This attribute allows generic type inference to use the specified type parameter automatically with descendants that have a type parameter with the same name.

关于blazor - Blazor 中的级联 @typeparam,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68004632/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com