В моем классе класса он содержит IdValues, который равен int?[]
. Значения взяты из другого класса с идентификатором в качестве ключевого поля.Невозможно неявно преобразовать тип int [] в int? []
//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.
}
Ошибка Не удается неявно преобразовать тип int[]
в int?[]