使用 LinqToTwitter 访问 Twitter 数据时出错
Getting Error Accessing Twitter Data While Using LinqToTwitter
我正在使用此代码从 Twitter 用户的屏幕名称中获取姓名:
var users =
(from user in twitterCtx.User
where user.Type == UserType.Lookup &&
user.ScreenName == "JoeMayo,LinqToTweeter"
select user)
.ToList();
users.ForEach(user => Console.WriteLine("Name: " + user.Name));
但我收到此错误消息:
System.AggregateException: One or more errors occurred. —-> System.ArgumentException: Query must contain one of either ScreenNameList or UserIdList parameters, but not both.
如何解决这个问题?
你很接近 - 你需要做的就是将 user.ScreenName
替换为 user.ScreenNameList
,如下所示:
var users =
(from user in twitterCtx.User
where user.Type == UserType.Lookup &&
user.ScreenNameList == "JoeMayo,LinqToTweeter"
select user)
.ToList();
users.ForEach(user => Console.WriteLine("Name: " + user.Name));
您可以找到 运行 Demo in the source code. There's documentation available too.
我正在使用此代码从 Twitter 用户的屏幕名称中获取姓名:
var users =
(from user in twitterCtx.User
where user.Type == UserType.Lookup &&
user.ScreenName == "JoeMayo,LinqToTweeter"
select user)
.ToList();
users.ForEach(user => Console.WriteLine("Name: " + user.Name));
但我收到此错误消息:
System.AggregateException: One or more errors occurred. —-> System.ArgumentException: Query must contain one of either ScreenNameList or UserIdList parameters, but not both.
如何解决这个问题?
你很接近 - 你需要做的就是将 user.ScreenName
替换为 user.ScreenNameList
,如下所示:
var users =
(from user in twitterCtx.User
where user.Type == UserType.Lookup &&
user.ScreenNameList == "JoeMayo,LinqToTweeter"
select user)
.ToList();
users.ForEach(user => Console.WriteLine("Name: " + user.Name));
您可以找到 运行 Demo in the source code. There's documentation available too.