C#C
C#4y ago
Shunrai

Communication between variables in Multiple Threads

Hello,

I am kinda new to this and I've never really worked with multi threads, decided to finally learn but I can't figure out how I can read the variables of one thread in the other.
C#
        void Kekw1()
        {
            while (true)
            {
                string image1 = (@"C:\rumblered7.PNG");
                string[] results1 = UseImageSearch(image1, "10");
                if (results1 == null)
                {
                    MessageBox.Show("null value bro, sad day");
                }
                else
                {
                    int bananaX1 = Int32.Parse(results1[1]);
                    int bananaY1 = Int32.Parse(results1[2]);
                    MessageBox.Show("Banana Results:" + bananaX1 + ", " + bananaY1);
                }
            }
        }
        void Kekw2()
        {
            while (true)
            {
                string image2 = (@"C:\rumblered2.PNG");
                string[] results2 = UseImageSearch(image2, "15");
                if (results2 == null)
                {
                    MessageBox.Show("null value bro, sad day");
                }
                else
                {
                    int bananaX2 = Int32.Parse(results2[1]);
                    int bananaY2 = Int32.Parse(results2[2]);
                    MessageBox.Show("Banana Results 2:" + bananaX2 + ", " + bananaY2);
                }
            }
        }
Was this page helpful?