public bool CheckVectors(VectorObject Vobject) { bool isValid = true ; isValid= Vobject.Operation == "Suma"; isValid = Vobject.Vectors.Count == 2; isValid = Vobject.NumberParams > 0; return isValid; }
public string ConvertToJson(int[] addition) { List<Tuple<string, int[]>> vectors= new List<Tuple<string,int[]>>(); vectors.Add(new Tuple<string,int[]>("vector", addition)); VectorObject vObject = new VectorObject() { NumberParams = 1, Vectors = vectors }; return JsonConvert.SerializeObject(vObject); }
private string convertToJson(int[] vector1, int[]vector2) { List<Tuple<string, int[]>> vectors= new List<Tuple<string, int[]>>(); vectors.Add(new Tuple<string,int[]>("enteros", vector1)); vectors.Add(new Tuple<string,int[]>("enteros", vector2)); VectorObject vObject= new VectorObject(){ NumberParams=2, Operation="Suma", Vectors= vectors }; return JsonConvert.SerializeObject(vObject); }
public List<int[]> getVectors(VectorObject result) { return result.Vectors.Select(x => x.Item2).ToList(); }