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

140
Views
Convertir campo repetido en lista

.Red

Mi archivo protobuf:

 message Result{ repeated ListOfStrings lists = 1; } message ListOfStrings { repeated string strings = 1; }

Y tengo una clase con esta propiedad:

 public List<List<string>> ListOfLists { get; set; }

El compilador Protobuf genera la colección RepeatedField y cuando intento pasar esta colección a ListOfLists.AddRange() este error:

cannot convert from 'Google.ProtobufCollections.RepeatedField<gRPC.ListOfStrings>' to 'System.Collection.Generic.IEnumerable<System.Collections.Generic.List<string>>

¿Como lidiar con?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Una List<List<string>> no es lo mismo que una lista de cosas que tienen cadenas. Probablemente necesitará:

 foreach (var list in outerList) { var inner = new ListOfStrings(); inner.Strings.AddRange(list); obj.Lists.Add(inner); }
over 4 years ago · Santiago Trujillo Report

0

¿Puedes probar el método CopyTo , doc ?

Ejemplo de código de pseudocódigo:

 Result result = ... foreach(var list in result.list) { string[] arr = new string[list.Count]; list.CopyTo(arr,0); ListOfLists.Add(arr.ToList()); }
over 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!