0

有人可以帮我弄这个吗?我倾向于主要在 VB 中工作,所以这个 C# 编译错误是一个问题:

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Threading.Tasks;
using Microsoft.ServiceBus.Messaging;

public static class ServiceBusTaskExtensions
{
    public static Task SendAsync(this TopicClient client, BrokeredMessage message)
    {
        return Task.Factory.FromAsync((cb, state) => client.BeginSend((BrokeredMessage)state, cb, null), client.EndSend, message);
    }
}

.FromAsync 函数调用内部出现红色下划线,编译错误为;“无法将 lambda 表达式转换为类型‘System.IAsyncResult’,因为它不是委托类型”。

4

0 回答 0