ObjectPoint.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. namespace IndexFormula.Finance
  2. {
  3. using System;
  4. using System.Globalization;
  5. using System.Runtime.InteropServices;
  6. using System.Xml.Serialization;
  7. [StructLayout(LayoutKind.Sequential)]
  8. public struct ObjectPoint
  9. {
  10. private double x;
  11. private double y;
  12. [XmlAttribute]
  13. public double X
  14. {
  15. get
  16. {
  17. return this.x;
  18. }
  19. set
  20. {
  21. this.x = value;
  22. }
  23. }
  24. [XmlAttribute]
  25. public double Y
  26. {
  27. get
  28. {
  29. return this.y;
  30. }
  31. set
  32. {
  33. this.y = value;
  34. }
  35. }
  36. public override string ToString()
  37. {
  38. return ("{" + DateTime.FromOADate(this.x).ToString("yyyy-MM-dd", DateTimeFormatInfo.InvariantInfo) + "," + this.y.ToString("f3") + "}");
  39. }
  40. public ObjectPoint(double x, double y)
  41. {
  42. this.x = x;
  43. this.y = y;
  44. }
  45. public static ObjectPoint Empty
  46. {
  47. get
  48. {
  49. ObjectPoint point = new ObjectPoint();
  50. point.X = double.NaN;
  51. point.Y = double.NaN;
  52. return point;
  53. }
  54. }
  55. }
  56. }