예제 #1
0
        /// <summary>
        /// Requests Information Regarding the properties of an entity. Performs action sequentially.
        /// </summary>
        /// <param name="resourceUrlList"></param>
        /// <param name="filmHandler"></param>
        /// <param name="args"></param>
        public static void SequentialEntityPropertyLoop(List <string> resourceUrlList, FilmHandler filmHandler, string[] args)
        {
            List <string> resultsList = new List <String>();

            foreach (var url in resourceUrlList)
            {
                string prop = filmHandler.GetEntityProperty(args[1], args[2], url);
                if (resultsList.IndexOf(prop) == -1)
                {
                    resultsList.Add(prop);
                    Console.WriteLine(prop);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Requests Information Regarding the properties of an entity. Performs action through threading.
        /// </summary>
        /// <param name="resourceUrlList"></param>
        /// <param name="filmHandler"></param>
        /// <param name="args"></param>
        public static void ParallelEntityPropertyLoop(List <string> resourceUrlList, FilmHandler filmHandler, string[] args)
        {
            List <string> resultsList = new List <String>();

            Parallel.ForEach(resourceUrlList, new ParallelOptions()
            {
                MaxDegreeOfParallelism = 4
            }, url =>
            {
                string prop = filmHandler.GetEntityProperty(args[1], args[2], url);
                if (resultsList.IndexOf(prop) == -1)
                {
                    resultsList.Add(prop);
                    Console.WriteLine(prop);
                }
            });
        }