我有
public class ABSInfo
{
public decimal CodeCoveragePercentage { get; set; }
public TestInfo TestInformation { get; set; }
}
我有一个对象数组说“SourceType”
public object[] SourceType { get; set; }
我想将对象数组(SoiurceType)转换为 ABSInfo[]。
我正在尝试
ABSInfo[] absInfo = Array.ConvertAll(SourceType, x => (ABSInfo)x);
但错误
无法将“WindowsFormsApplication1.TestInfo”类型的对象转换为“WindowsFormsApplication1.ABSInfo”类型。
如何进行转换?
编辑:
public class TestInfo
{
public int RunID { get; set; }
public TestRunStatus Status { get; set; }
public string Description { get; set; }
public int TotalTestCases { get; set; }
public int TotalTestCasesPassed { get; set; }
public int TotalTestCasesFailed { get; set; }
public int TotalTestCasesInconclusive { get; set; }
public string ReportTo { get; set; }
public string Modules { get; set; }
public string CodeStream { get; set; }
public int RetryCount { get; set; }
public bool IsCodeCoverageRequired { get; set; }
public FrameWorkVersion FrameworkVersion { get; set; }
public string TimeTaken { get; set; }
public int ProcessID { get; set; }
public int GroupID { get; set; }
public string GroupName { get; set; }
}