高分求大神帮忙

qq_38234381 qq_38234381 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Text;

namespace Exercise11
{
class Program
{
static int Test1(int x, string s)
{
Console.WriteLine("Test1");
Thread.Sleep(100);
return 100;
}
static void Main(string[] args)
{
Func<int, string, int> a = Test1;
IAsyncResult ar = a.BeginInvoke(100, "tqt", null, null);//编译器提示这里有错
Console.WriteLine("main");
while (ar.IsCompleted == false)
Console.Write(".");
int result = a.EndInvoke(ar);
Console.WriteLine(result);
}
}
}

在VS2019中编译通过,运行时错误信息是System.PlatformNotSupportedException: Operation is not supported on this platform.
是BeginInvoke这个函数的错误吗?求大神。
...全文
评论 9
收藏 已收藏
分享
返回顶部
qq_38234381
C# 111,130 成员 642,539 内容