0

我在我的 UI 上显示了许多自定义数据类型(内部实现为结构)。我希望使用 Fody.PropertyChanged 但它似乎只适用于类而不适用于结构。

示例代码:

namespace FodyQuestion
{
    [ImplementPropertyChanged]
    public struct FodyStruct
    {
        public int MyProperty { get; set; }
    }
}

我看到的错误是:

Error   1   Attribute 'ImplementPropertyChanged' is not valid on this declaration type. It is only valid on 'class' declarations.

有没有人能够通过一些解决方法做到这一点?我愿意查看 Fody 的源代码并在需要时进行更改。任何指针?

4

0 回答 0