我想以这样一种方式形成一个模型,当我返回客户端时,我将通过一个点和一个属性而不是通过数组中的数字进行联系。例子
有多种型号。
public class InstrumentEntity
{
public string Symbol { get; set; }
public Indicators Values { get; set; }
}
public class Indicators
{
public double LastPrice { get; set; }
public double Change { get; set; }
public string PerChange { get; set; }
}
在这里我正在填充模型
List<InstrumentEntity> stocks = new List<InstrumentEntity>();
Indicators indicators = new Indicators()
{
LastPrice = 95,
Change = 0,35,
PerChange = %0,12
};
InstrumentEntity aa= new InstrumentEntity();
aa.Symbol = "AA";
aa.Values = indicators;
stocks.Add(aa);
又是一样的
Indicators indicators = new Indicators()
{
LastPrice = 95,
Change = 0,35,
PerChange = %0,12
};
InstrumentEntity bac = new InstrumentEntity();
bac.Symbol = "bac";
bac.Values = indicators;
stocks.Add(bac);
以 6 次为例。
现在我把它装在一个杰森里,然后送到前面。在前面,我将以数组的形式拥有它
result[0].symbol像这样。如何形成什么,从第一个属性开始,我将通过符号引用?毕竟,到处都有相同的模型。
我想我猜到了你想要什么。
改用.
Dictionary<string, ...>_List<...>