【发布时间】:2017-03-29 13:24:41
【问题描述】:
我有一个具有以下属性的类
public class Curve
{
public string CurveName { get; set; }
public string RefSource { get; set; }
public int price1 { get; set; }
public int price2 { get; set; }
public int price3 { get; set; }
public static List<Curve> GetCurveList()
{
List<Curve> data = new List<Curve>()
{
new Curve() { CurveName="Lamar", price1 = 1, price2 = 101,price3=104,RefSource="Tome" },
new Curve() { CurveName="Lamar", price1 = 2, price2 = 201,price3=204,RefSource="Richard" }
}
我需要它在另一个列表中转换为以下属性
curveName=lamar,refSource=richard ,hour=(name of the property of price1, price2,price3)taking integer of the last part of the enclosed property,value associated with the price property
curveName=lamar,refSource=Tom,hour=(name of the property of price1, price2,price3)taking integer of the last part of the enclosed property,value associated with the price property
基本上,源列表的两项应根据参考源生成一个新的 6 行列表,每个属性都标为价格,它需要如下所示
名称 RefSource 小时值 拉马尔汤姆 1 1 拉马尔汤姆 2 101 拉马尔汤姆 3 104 拉马尔理查德 1 2 拉马尔 理查德 2 201 拉马尔 理查德 3 204小时列是源列表中属性名称Price1、price2、price3的后缀。
【问题讨论】: