本文整理汇总了C#中System.Collections.Specialized.NameValueCollection.BuildUri方法的典型用法代码示例。如果您正苦于以下问题:C# NameValueCollection.BuildUri方法的具体用法?C# NameValueCollection.BuildUri怎么用?C# NameValueCollection.BuildUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.NameValueCollection
的用法示例。
在下文中一共展示了NameValueCollection.BuildUri方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMatchesForPlayer
public static Uri GetMatchesForPlayer(string gamertag, GameMode gamemode = GameMode.All, int start = 0, int count = 25)
{
var values = new NameValueCollection();
if (gamemode != GameMode.All)
{
values.Add("modes", gamemode.ToString().ToLower());
}
if (start > 0)
{
values.Add("start", start.ToString());
}
if (count > 0 && count < 25 )
{
values.Add("count",count.ToString());
}
string baseUrl = string.Format("{0}/{1}/{2}/players/{3}/matches?",MajorPrefix,MinorPrefix,Title,gamertag);
return values.BuildUri(baseUrl);
}
示例2: GetSpartanImage
public static Uri GetSpartanImage(string gamerTag, int size = 256, CropType cropType = CropType.Full)
{
var values = new NameValueCollection
{
{"size", size.ToString()},
{"crop", cropType.ToString().ToLower()}
};
var baseUrl = string.Format("{0}/{1}/{2}/profiles/{3}/spartan", MajorPrefix, MinorPrefix, Title, gamerTag);
return values.BuildUri(baseUrl);
}
示例3: GetEmblemImage
public static Uri GetEmblemImage(string gamerTag, int size = 256)
{
var values = new NameValueCollection {{"size", size.ToString()}};
var baseUrl = string.Format("{0}/{1}/{2}/profiles/{3}/emblem", MajorPrefix, MinorPrefix, Title,gamerTag);
return values.BuildUri(baseUrl);
}
示例4: ListMapVariants
public static Uri ListMapVariants(string gamertag, int start = 0, int count = 25, Sort sort = Sort.Modified, Order order = Order.Desc)
{
var values = new NameValueCollection();
if (sort != Sort.Modified)
{
values.Add("sort", sort.ToString());
}
if (order != Order.Desc)
{
values.Add("order", order.ToString());
}
if (start > 0)
{
values.Add("start", start.ToString());
}
if (count > 0 && count < 25)
{
values.Add("count", count.ToString());
}
string baseUrl = string.Format("{0}/{1}/{2}/players/{3}/mapvariants?", MajorPrefix, MinorPrefix, Title, gamertag);
return values.BuildUri(baseUrl);
}