Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

260
Vistas
Convert elements in List<string> to List<Texture> in C# (Unity3d)

How should I best go about converting the elements of

List<string> icons

to:

List<Texture> icons

I'm pulling filenames from an XML file (thus the initial string format) but I want to convert the filenames to texture format because they are dynamically formed at runtime so I can't load from the inspector.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use ConvertAll<T>

icons.ConvertAll<Texture>(s => new Texture(..whatever conversion...))

or you can use LINQ to transform

from s in icons select new Texture(...)

both prety much boil down to the same. Difference is that LINQ gives you an IEnumerable that pools data directly from string list (without creating a new list) so its good for once-off uses. If you need a persisten list of Textures either use ConvertAll or pin down the IEnumerable using ToList()

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda