本文整理汇总了C#中QueryParameters.AddIndexed方法的典型用法代码示例。如果您正苦于以下问题:C# QueryParameters.AddIndexed方法的具体用法?C# QueryParameters.AddIndexed怎么用?C# QueryParameters.AddIndexed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryParameters
的用法示例。
在下文中一共展示了QueryParameters.AddIndexed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateScrobbleQueryParams
string CreateScrobbleQueryParams (IEnumerable<Track> batch)
{
var queryParameters = new QueryParameters {
Tuple.Create ("method", "track.scrobble"),
Tuple.Create ("api_key", LastFMAppCredentials.APIKey),
Tuple.Create ("sk", SessionKey),
};
int trackNumber = 0;
foreach (var track in batch) {
queryParameters.AddIndexed ("artist", track.TrackArtist, trackNumber);
queryParameters.AddIndexed ("track", track.Name, trackNumber);
queryParameters.AddIndexed ("timestamp", track.Timestamp.ToString (), trackNumber);
queryParameters.AddIndexed ("album", track.Album, trackNumber);
queryParameters.AddIndexed ("trackNumber", track.Number.ToString (), trackNumber);
queryParameters.AddIndexed ("duration", track.Duration.ToString (), trackNumber);
if (!string.IsNullOrEmpty (track.AlbumArtist))
queryParameters.AddIndexed ("albumArtist", track.AlbumArtist, trackNumber);
if (!string.IsNullOrEmpty (track.MusicBrainzId))
queryParameters.AddIndexed ("mbid", track.MusicBrainzId, trackNumber);
trackNumber ++;
}
return queryParameters.GenerateQueryString (LastFMAppCredentials.SharedSecret);
}