Advertisement
Guest User

Untitled

a guest
Jul 20th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. public enum DataType
  2. {
  3.     Unspecified,
  4.     Ai0
  5. }
  6.  
  7. public class DataPoint
  8. {
  9.     public int ID { get; set; }
  10.  
  11.     public DateTime Date { get; set; }
  12.  
  13.     public DataType DataType { get; set; }
  14.  
  15.     public float Value { get; set; }
  16.  
  17.     [Obsolete("do not use this for initialisation. It's for searalization only")]
  18.     public DataPoint(){}
  19.  
  20.     public DataPoint(DataType DataType, float Value)
  21.     {
  22.         ID = Program.GetNewID();
  23.         Date = DateTime.UtcNow;
  24.         this.DataType = DataType;
  25.         this.Value = Value;
  26.     }
  27.  
  28.     public override string ToString()
  29.     {
  30.         return ID.ToString();
  31.     }
  32.  
  33.     public override bool Equals(object obj)
  34.     {
  35.         if (obj is DataPoint)
  36.             return ID == ((DataPoint)obj).ID;
  37.         return false;
  38.     }
  39.  
  40.     public override int GetHashCode()
  41.     {
  42.         return ID;
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement