我正在尝试在现有的链表中添加新电影名称,但出现了错误。
cannot convert from 'string' to 'System.Collections.Generic.LinkedListNode<string>'
这是我正在处理的代码:
LinkedList<string> movies = new LinkedList<string>();
movies.AddLast("Fire & Dew");
movies.AddLast("Hang Break");
movies.AddLast("Naughty Monkey");
movies.AddLast("Sabotage");
//Add movie name Good & Bad After Hang Break
movies.AddAfter("Hang Break", "Good & Bad");
foreach (string movie in movies)
{
Console.WriteLine(movie);
}
有什么解决方案和代码提示吗?