Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
C#7 tupla y asíncrono

Formato antiguo:

 private async Task<Tuple<SomeArray[], AnotherArray[], decimal>> GetInvoiceDetailAsync(InvoiceHead invoiceHead) { ... }

¿Cómo puedes hacer eso en C#7 con el nuevo formato de tuplas?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Paso 1: agregue el paquete nuget ValueTuple a su proyecto.

Paso 2: como dice Lucas en su comentario, cambia la sintaxis a:

 private async Task<(SomeArray[], AnotherArray[], decimal)>GetInvoiceDetailAsync( InvoiceHead invoiceHead) { ... return (x, y, z); }

Sin embargo, tenga en cuenta que también puede agregar nombres a esos elementos de tupla, en la línea de:

 private async Task<(SomeArray[] x, AnotherArray[] y, decimal z)>GetInvoiceDetailAsync( InvoiceHead invoiceHead) { ... return (x, y, z); }

Y luego puede acceder a ellos como esos nombres, en lugar de Item1 , Item2 y Item3 .

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!