我有下课
public class ComponentRedundancy
{
public int EquipmentQuantity { get; set; }
public double RedundancyPercentage { get; set; }
public Redundancy Redundancy { get; set; }
}
下面是一个枚举
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum Redundancy
{
[Description("N")]
N,
[Description("N+1")]
N_PLUS_1,
[Description("2N")]
N_MULTIPLY_2
}
List<ComponentRedundancy> componentRedundancy = new List<ComponentRedundancy>();
componentRedundancy.Add(new ComponentRedundancy(1, 70, N_MULTIPLY_2));
componentRedundancy.Add(new ComponentRedundancy(2, 50, N_PLUS_1));
componentRedundancy.Add(new ComponentRedundancy(3, 40, N));
我正在寻找合并所有这些值和结果会像这在单行字符串
[1@70%](2N)[2@50%](N+1)[3@40%](N)