小编Kop*_*nik的帖子

ReactiveUI - this.RaiseAndSetIfChanged

我通过nuget将最新的ReactiveUI(5.0.2)下载到基于.NET 4.5的项目中.

我用一个属性创建了简单的视图模型类:

using System;
using System.Threading;
using System.Windows;
using ReactiveUI.Xaml;

    namespace ReactiveUI.Study.ViewModels
    {
        public class ShellViewModel : ReactiveObject
        {
            #region Properties

            private string _login;

            public string Login
            {
                get
                {
                    return _login;
                }
                set
                {
                    this.RaiseAndSetIfChanged(x => x.Login, value);
                }
            }

        }
    }
Run Code Online (Sandbox Code Playgroud)

当我尝试编译我的项目时,我得到了异常

Cannot convert lambda expression to type 'ref string' because it is not a delegate type
Run Code Online (Sandbox Code Playgroud)

我刚开始学习我不知道这个问题的根源在哪里,因为我使用来自https://github.com/reactiveui/ReactiveUI.Samples/blob/master/ReactiveUI_4Only.Samples.sln的样本

并且所有项目都基于.NET 4.0,并且还使用旧版本的ReactiveUI.

谢谢

c# wpf reactiveui .net-4.5

2
推荐指数
1
解决办法
3124
查看次数

标签 统计

.net-4.5 ×1

c# ×1

reactiveui ×1

wpf ×1