小编use*_*631的帖子

无法将int []类型隐式转换为int?[]

在我的示例类中,它包含IdValues int?[].值来自具有Id作为关键字段的其他类.

//Database class
public class SampleValues // this is a entity that i want to collect the deatil id
{
    public int Id { get; set; }
    public int?[] SampleDetailIdValue { get; set; }
}

public class SampleDetailValues // this is the detail entity
{
    public int Id { get; set; }
}


// The error code
if (sampleDetails.Count > 0)
{
    sample.IdValues = sampleDetails.Select(s => s.Id).ToArray(); // << The error occurred this line.
}
Run Code Online (Sandbox Code Playgroud)

错误是无法将类型隐式转换int[] …

c# entity-framework

4
推荐指数
1
解决办法
2649
查看次数

如何取消订阅MvvmCross中的WeakSubscribe

_parameter.WeakSubscribe(() => _parameter.Value, HandleValueChanged);
Run Code Online (Sandbox Code Playgroud)

我像上面那样使用WeakSubscribe.

我的方案是当值发生变化时,系统将添加一个新参数,当前将取消订阅该事件.

我发现了这个问题,但它不起作用.

c# wpf events xaml mvvmcross

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

标签 统计

c# ×2

entity-framework ×1

events ×1

mvvmcross ×1

wpf ×1

xaml ×1