在我的示例类中,它包含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[] …
_parameter.WeakSubscribe(() => _parameter.Value, HandleValueChanged);
Run Code Online (Sandbox Code Playgroud)
我像上面那样使用WeakSubscribe.
我的方案是当值发生变化时,系统将添加一个新参数,当前将取消订阅该事件.
我发现了这个问题,但它不起作用.