Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
集合属性中的C#Lambda_C#_Properties_Lambda_Set - Fatal编程技术网

集合属性中的C#Lambda

集合属性中的C#Lambda,c#,properties,lambda,set,C#,Properties,Lambda,Set,通过阅读c#示例,我发现lambda在set属性中的用法: private bool _inProgress; public bool InProgress { get { return _inProgress; } set { Set(() => InProgress, ref _inProgress, value); } } 然而,这对我不起作用

通过阅读c#示例,我发现lambda在set属性中的用法:

 private bool _inProgress;
 public bool InProgress
        {
            get {
                return _inProgress;
            }
            set { Set(() => InProgress, ref _inProgress, value); }
        }
然而,这对我不起作用,我明白了

the name "Set" does not exist in current context
错误


我发现这个语法
{Set(()=>InProgress,value);}
等于
{returninprogress=value;}
正确吗?但是我仍然得到
名称“Set”在当前上下文中不存在
错误。

查看您找到它的类,您会发现它继承自另一个类,因此
集合
可能是一个超类的成员,要使其工作,您的类也必须继承该类。

查看您找到它的类,您会发现它继承了另一个类,因此该集合可能是超级类的成员,要使其工作,您的类必须继承该类tooThanks,我没有注意到它是从mvvn light ViewModelBase继承的它解决了它