Bonjour,

Je souhaiterais connaître le type de retour à attribuer à une méthode effectuant un select avec LINQ.
Je m'explique.

J'ai un service WCF qui effectue une requête dans une table nommée TECHNO :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
namespace WcfThierry
{    
    public class DataTechno : IDataTechno
    {
        public List<quel type choisir ?> getTechno()
        {
            TechnoDataContext dc = new TechnoDataContext();

            var allTechno = (from techno in dc.TECHNO orderby techno.LIBELLE_TECHNO select new { techno.ID_TECHNO, techno.LIBELLE_TECHNO });
            return allTechno.ToList();
            
        }        

       
    }
}
Ceci me retourne une erreur
impossible de convertir implicitement List<Anonymous Type> en List<TECHNO>
car le type de retour que je définis pour la méthode getTechno() est faux.

Pour info, j'ai d'abord mis comme type un "string" puis j'ai crée une structure à 2 élément (un int comme ID_TECHNO et un string comme LIBELLE_TECHNO) mais sans résultat.

Avez-vous une idée ?
Merci.
T.