ParamCollection.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. namespace IndexFormula.Finance
  2. {
  3. using System;
  4. using System.Collections;
  5. using System.Reflection;
  6. using System.Text;
  7. public class ParamCollection : CollectionBase
  8. {
  9. public int Add(FormulaParam fp)
  10. {
  11. return base.List.Add(fp);
  12. }
  13. public string[] GetParamList()
  14. {
  15. ArrayList list = new ArrayList();
  16. foreach (object obj2 in base.List)
  17. {
  18. list.Add(((FormulaParam) obj2).Name);
  19. }
  20. return (string[]) list.ToArray(typeof(string));
  21. }
  22. public void Remove(FormulaParam fp)
  23. {
  24. base.List.Remove(fp);
  25. }
  26. public override string ToString()
  27. {
  28. StringBuilder builder = new StringBuilder();
  29. for (int i = 0; i < base.Count; i++)
  30. {
  31. if (i != 0)
  32. {
  33. builder.Append(",");
  34. }
  35. string str = this[i].Value;
  36. if (str.IndexOf(',') >= 0)
  37. {
  38. str = "\"" + str + "\"";
  39. }
  40. builder.Append(str);
  41. }
  42. return builder.ToString();
  43. }
  44. public FormulaParam this[int Index]
  45. {
  46. get
  47. {
  48. return (FormulaParam) base.List[Index];
  49. }
  50. }
  51. public FormulaParam this[string Name]
  52. {
  53. get
  54. {
  55. foreach (object obj2 in base.List)
  56. {
  57. if (((FormulaParam) obj2).Name == Name)
  58. {
  59. return (FormulaParam) obj2;
  60. }
  61. }
  62. return null;
  63. }
  64. }
  65. }
  66. }