KonataDev / Konata.Core

Android QQ protocol core implementation written in C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

将 Konata.Core.Common.BotConfig.Protocol 改写成自动属性

frg2089 opened this issue · comments

这里不使用自动属性而使用字段是预期的吗?
将这里改成自动属性会影响 Konata.Core 的正常功能吗?

我在尝试用通用主机编写一个 bot,在绑定配置的时候发现 BotConfig 的 Protocol 不起作用。
经过排查后发现这里是一个字段而不是一个属性。

我不得不像这样创建一个继承自 BotConfig 的类使得配置绑定能够工作。

internal sealed class BotConfigHack : BotConfig
{
    public new OicqProtocol Protocol
    {
        get => base.Protocol;
        set => base.Protocol = value;
    }
}

public OicqProtocol Protocol;

這個應該是編寫時的疏忽,它應該使用自動屬性。