Message d'erreur "impossible de convertir implicitement le type.."
Bonjour,
j'ai écrit une petite méthode pour savoir si je peut faire un "return" d'une list de classe.
Voici la description de ma petite classe :
Code:
1 2 3 4 5 6 7 8 9 10 11
| public class CLS_STR_EQUIPE_FOOT
{
// --------> Description Equipe <--------
// Numéro equipe
public int NUM_EQUIPE;
// Nom equipe
public string NOM_EQUIPE;
//Couleur equipe
public string COULEUR_EQUIPE;
} |
Et voici le code de ma méthode :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| class CLS_EQUIPE_FOOT
{
public CLS_STR_EQUIPE_FOOT STR_EQUIPE = new CLS_STR_EQUIPE_FOOT();
public List<CLS_STR_EQUIPE_FOOT> CHARGE_EQUIPE_FOOT()
{
STR_EQUIPE.NUM_EQUIPE = 1;
STR_EQUIPE.NOM_EQUIPE = "LES BONDISSANTS";
STR_EQUIPE.COULEUR_EQUIPE = "ROUGES & BLANCS";
STR_EQUIPE.NUM_EQUIPE = 2;
STR_EQUIPE.NOM_EQUIPE = "LES VERTS";
STR_EQUIPE.COULEUR_EQUIPE = "VERTS & BLANCS";
STR_EQUIPE.NUM_EQUIPE = 3;
STR_EQUIPE.NOM_EQUIPE = "LES VIOLETS";
STR_EQUIPE.COULEUR_EQUIPE = "VIOLET & BLANCS";
return (STR_EQUIPE);
}
} |
Le compilateur me rejette le "return (STR_EQUIPE) avec le message :
"Impossible de convertir implicitement le "WINDEV_CLASS_DLL.STR_EQUIPE_FOOT" en 'Système.Collections.Generic.List<WINDEV_CLASS_DLL.CLS_STR_EQUIPE_FOOT>
Je ne comprends pas le message . Normalement, j'ai le droit de renvoyer une liste de classe depuis une méthode ? :calim2:
Merci pour votre aide .