Sends for the fellow dear visitors:welcome to dongpad!


 Welcome to DongPad!

 msn


预览模式: 普通 | 列表

about GFW


Original Video- More videos at TinyPic

Tags: GFW

分类:Life | 固定链接 |评论: 0| 引用: 0 | 查看次数: 400 | 返回顶部
The problem the user is seeing is that the Thread ctor accepts a specific delegate -- the ThreadStart delegate. The C# compiler will check and make sure your anonymous method matches the signature of the ThreadStart delegate and, if so, produces the proper code under-the-covers to create the ThreadStart delegate for you.
But Control.Invoke is typed as accepting a "Delegate". This means it can accept any delegate-derived type. The example above shows an anonymous method that has a void return type and takes no parameters. It's possible to have a number of delegate-derived types that match that signature (such as MethodInvoker and ThreadStart -- just as an example). Which specific delegate should the C# compiler use? There's no way for it to infer the exact delegate type so the compiler complains with an error.

Tags: System.Delegate

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 300 | 返回顶部