Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

135
Visualizações
Passing Arrays to blazors IJSRuntime.InvokeAsync

I wonder what is the best way to pass an array to IJSRuntime.InvokeAsync.
The problem I stumbled upon is that blazor will pass each element of the array as a parameter to the javascript function since InvokeAsync has an open parameter list and will not know if you just passed arguments of the same type or an array.

For now I just go with a second parameter like InvokeAsync("functionname", array, false).

Any other suggestions? Better solutions?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You'd either have to cast your array to object* or call the Extension method directly:

var array = Array.Empty<Baz>();
// Casting to object
JS.InvokeAsync<Foo>("bar", (object)array);

// Explicitly call the extension method:
JSRuntimeExtensions.InvokeAsync<Foo>(JS, "bar", array);

Or just use the overload it thinks you are attempting to call:

JS.InvokeAsync<Foo>("bar", new object[] { array });

* Based on my limited knowledge of C#'s Overload Resolution.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda