C# C语言中的AsanaNet错误#
我无法从C#使用AsanaNet。当实例化一个新的Asana实例时,我无法传递errorCallback。我得到的错误是“errorCallback在当前上下文中不存在”。下面是我的代码C# C语言中的AsanaNet错误#,c#,asana,C#,Asana,我无法从C#使用AsanaNet。当实例化一个新的Asana实例时,我无法传递errorCallback。我得到的错误是“errorCallback在当前上下文中不存在”。下面是我的代码 class Program { private const string _apiKey = "API"; private static Asana _asana; static void Main(string[] args) { Console.WriteL
class Program
{
private const string _apiKey = "API";
private static Asana _asana;
static void Main(string[] args)
{
Console.WriteLine("Step 1");
_asana = new Asana(_apiKey, AuthenticationType.Basic, errorCallback);
var user = new AsanaUser();
_asana.GetMe(o =>
{
user = o as AsanaUser;
});
Console.WriteLine("Step 2");
_asana.GetWorkspaces(o =>
{
foreach (AsanaWorkspace workspace in o)
{
Console.WriteLine("Workspace Name={0}", workspace.Name);
}
});
Console.WriteLine("Step 3");
_asana.GetWorkspaces(o =>
{
foreach (AsanaWorkspace workspace in o)
{
_asana.GetProjectsInWorkspace(workspace, projects =>
{
foreach (AsanaProject project in projects)
{
Console.WriteLine("Project Name=" + project.Name);
}
}
);
}
});
}
}
根据,建造商有以下签名:
public Asana(string apiKeyOrBearerToken, AuthenticationType authType, Action<string, string, string> errorCallback)
此外,如果您不想处理任何事情,可以将空lambda传递到构造函数中:
_asana = new Asana(_apiKey, AuthenticationType.Basic, (s1, s2, s3) => {});
您的
errorCallback
声明在哪里?
_asana = new Asana(_apiKey, AuthenticationType.Basic, (s1, s2, s3) => {});