Erreur : does not contain a definition
Bonjour,
J'essaie de compiler le code ci-dessous mais j'obtiens une erreur.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| using System;
public class Song
{
private string name;
public Song nextSong { get; set; }
public Song(string name)
{
this.name = name;
}
public void setNextSong(Song nextSong)
{
this.nextSong = this.nextSong;
}
public bool isRepeatingPlaylist()
{
Song slowStep = this;
Song fastStep = this;
while (((fastStep != null) && (fastStep.nextSong != null)))
{
slowStep = slowStep.nextSong;
fastStep = fastStep.nextSong.nextSong;
if ((slowStep == fastStep))
{
return true;
}
}
return false;
}
public static void Main(string[] args)
{
Song first = new Song("Hello");
Song second = new Song("Eye of the tiger");
first.nextSong = second;
second.nextSong = first;
Console.WriteLine(first.IsRepeatingPlaylist());
}
} |
L'erreur est la suivante :
Citation:
Compiler output:
PlaylistTest.cs(15,30): error CS1061: 'Song' does not contain a definition for 'NextSong' and no extension method 'NextSong' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(21,30): error CS1061: 'Song' does not contain a definition for 'NextSong' and no extension method 'NextSong' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(26,47): error CS1061: 'Song' does not contain a definition for 'IsRepeatingPlaylist' and no extension method 'IsRepeatingPlaylist' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(35,15): error CS1061: 'Song' does not contain a definition for 'NextSong' and no extension method 'NextSong' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(36,16): error CS1061: 'Song' does not contain a definition for 'NextSong' and no extension method 'NextSong' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(37,31): error CS1061: 'Song' does not contain a definition for 'IsRepeatingPlaylist' and no extension method 'IsRepeatingPlaylist' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(65,15): error CS1061: 'Song' does not contain a definition for 'NextSong' and no extension method 'NextSong' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(66,15): error CS1061: 'Song' does not contain a definition for 'NextSong' and no extension method 'NextSong' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(67,15): error CS1061: 'Song' does not contain a definition for 'NextSong' and no extension method 'NextSong' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(68,15): error CS1061: 'Song' does not contain a definition for 'NextSong' and no extension method 'NextSong' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
PlaylistTest.cs(69,31): error CS1061: 'Song' does not contain a definition for 'IsRepeatingPlaylist' and no extension method 'IsRepeatingPlaylist' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
Playlist.cs(46,33): error CS1061: 'Song' does not contain a definition for 'IsRepeatingPlaylist' and no extension method 'IsRepeatingPlaylist' accepting a first argument of type 'Song' could be found (are you missing a using directive or an assembly reference?)
Merci pour votre aide