添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

"System.threading.threadStart' is a 'type', which is not valid in the given context'? (C#)

Ask Question

I got the error on var ts = System.Threading.ThreadStart(delegate() (Red line has drown under System.Threading.ThreadStart ). What is the problem?

using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
    class Program
        public Program()
            int[] iArray = new int[3];
            iArray[0] = 2;
            iArray[1] = 1;
            iArray[2] = 5;
            var ts = System.Threading.ThreadStart(delegate()
                foreach (int i in iArray)
                    Foo(i);
        public void Foo(int i)
            Console.WriteLine(i + ",");
        public static void Main(String[] args)
            Program p = new Program();
                Well, .. I don't know if to thank you for solving it, or just get angry with you, because you showed me out how much stupid I was.   But I'm just kidding. I should pay a bit more attention. thank you!  :)
– Billie
                Dec 16, 2012 at 13:02
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.