Exemple #1
0
 protected StrategyBase()
 {
     //处理参数
     DicProperties.Clear();
     foreach (var v in GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static))
     {
         object[] ps = v.GetCustomAttributes(typeof(ParameterAttribute), false);
         if (ps.Length <= 0)
         {
             continue;
         }
         ParameterAttribute pa = (ParameterAttribute)ps[0];
         Property           p  = new Property(v.Name, v.GetValue(this))
         {
             Category = pa.Category, Description = pa.Description
         };
         Add(p);
     }
 }
 /// <summary>
 /// 构造器:Strategy
 /// </summary>
 protected Strategy()
 {
     this.BarSerieses   = new List <BarSeries>();
     this.StrategyDatas = new List <StrategyData>();
     //属性参数字典处理
     DicProperties.Clear();
     FieldInfo[] fis = GetType().GetFields(this.Bf);
     foreach (var v in fis)
     {
         object[] ps = v.GetCustomAttributes(typeof(ParameterAttribute), false);
         if (ps.Length <= 0)
         {
             continue;
         }
         ParameterAttribute pa = (ParameterAttribute)ps[0];
         Property           p  = new Property(v.Name, v.GetValue(this))
         {
             Category = pa.Category, Description = pa.Description
         };
         Add(p);
     }
 }