示例#1
0
        public override bool Equals(object obj)
        {
            CalculationResult other = obj as CalculationResult;

            if (other == null)
            {
                return(false);
            }
            if (!WorkerId.Equals(other.WorkerId))
            {
                return(false);
            }
            if (Time != other.Time)
            {
                return(false);
            }
            if (Row != other.Row)
            {
                return(false);
            }
            if (Result.Count() != other.Result.Count())
            {
                return(false);
            }
            for (int i = 0; i < Result.Count(); i++)
            {
                if (Result[i] != other.Result[i])
                {
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        public static byte[] ToBytes(CalculationResult result)
        {
            var            message    = new StringBuilder("");
            JsonSerializer serializer = new JsonSerializer();

            using (StringWriter sw = new StringWriter(message))
            {
                serializer.Serialize(sw, result);
            }
            return(Encoding.UTF8.GetBytes(message.ToString()));
        }