带有列表序列化错误的对话框(bot框架)

时间:2017-08-17 13:16:55

标签: list serialization dialog botframework

当我尝试编译代码时出现以下错误:

错误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...
    }
}

如果有人知道,请告诉我。

0 个答案:

没有答案
相关问题