0
private void UserYoutubeService()
{
var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = Assembly.GetExecutingAssembly().GetName().Name
});
}
而且我想使用的变量youtubeService
这个方法:如何在另一种方法的方法中使用局部变量?
static List<string> videosList = new List<string>();
public async void RetrieveUploadsList()
{
UserCredentials();
UserYoutubeService();
var channelsListRequest = youtubeService.Channels.List("contentDetails");
}
我使用的方法UserYoutubeService
在我的代码其他地方,但现在我需要使用局部变量在youtubeService
性质方法RetrieveUploadsList
。我怎样才能通过变量youtubeService
出UserYoutubeService
?
你试过返回动态。专用动态UserYoutubeService(){返回新YouTubeService(新BaseClientService.Initializer() { HttpClientInitializer =凭证, 应用程序名= Assembly.GetExecutingAssembly()的GetName()命名 }); } –