C#C
C#3y ago
CrosRoad95

❔ Spread like operator in blazor

i have some .razor component accepting class, but i would like to pass individual parameters to it, let's say:
public class Foo{
  public string Test1 {get;set;}
  public string Test2 {get;set;}
}

// and my .razor component:
Foo fooClass = new();
<MyComponent ...fooClass />

MyComponent:
@code
{
[Parameter]
public string Test1 {get;set;}
[Parameter]
public string Test1 {get;set;}
}

is it possible? to use ... spread operator?
Was this page helpful?