当我尝试编译代码时出现以下错误:
错误CA2235:字段联系人是NamesDialog类型的成员,它是可序列化的,但类型为System.Collections.Generic.List,不可序列化
代码:
[Serializable]
public class Contact
{
public Contact(string sip, string name, int score)
{
this.Sip = sip;
this.Name = name;
this.score= score;
}
public string Sip { get; }
public string Name { get; }
public int score{ get; }
}
[Serializable]
public class NamesDialog : IDialog<Contact>
{
private readonly List<Contact> contacts;
public NamesDialog(List<Contact> contacts)
{
this.contacts = contacts;
}
// need to update.
public Task StartAsync(IDialogContext context)
{
something...
}
}
如果有人知道,请告诉我。