示例#1
0
        public string[] getSavedStocks() // convert to json
        {
            string[]           jsonArray;
            List <SavedStocks> list;

            try
            {
                list      = _stockScreenerService.GetAllSavedStocks();
                jsonArray = new string[list.Count];
            }
            catch (Exception ex)
            {
                if (ex is System.ArgumentNullException)
                {
                    Console.WriteLine("Exception " + ex);
                }

                Console.WriteLine("Exception " + ex);
                return(null);
            }


            for (int i = 0; i < list.Count; i++)
            {
                jsonArray[i] = JsonSerializer.Serialize(list[i]);
            }

            return(jsonArray);
        }