本文整理汇总了C#中System.Collections.Specialized.NameValueCollection.AddIfNotNullOrEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# NameValueCollection.AddIfNotNullOrEmpty方法的具体用法?C# NameValueCollection.AddIfNotNullOrEmpty怎么用?C# NameValueCollection.AddIfNotNullOrEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.NameValueCollection
的用法示例。
在下文中一共展示了NameValueCollection.AddIfNotNullOrEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetIssues
public IList<Issue> GetIssues(string projectId, string statusId, string assignedToId)
{
var parameters = new NameValueCollection();
parameters.AddIfNotNullOrEmpty("project_id", projectId);
parameters.AddIfNotNullOrEmpty("status_id", statusId);
parameters.AddIfNotNullOrEmpty("assigned_to_id", assignedToId);
return RedmineService.GetTotalObjectList<Issue>(parameters);
}
示例2: GetMemberships
public IList<Membership> GetMemberships(string userId)
{
var parameters = new NameValueCollection();
parameters.AddIfNotNullOrEmpty("user_id", userId);
return RedmineService.GetTotalObjectList<Membership>(parameters);
}
示例3: ShouldNotAddValueToCollectionIfNotEmpty
public void ShouldNotAddValueToCollectionIfNotEmpty()
{
var nameValueCollection = new NameValueCollection {{"test", "test"}};
nameValueCollection.AddIfNotNullOrEmpty(string.Empty, string.Empty);
Assert.That(1, Is.EqualTo(nameValueCollection.Count));
}
示例4: ShouldAddValueToCollectionIfNotEmpty
public void ShouldAddValueToCollectionIfNotEmpty()
{
var nameValueCollection = new NameValueCollection { { "test", "test" } };
nameValueCollection.AddIfNotNullOrEmpty("test1", "test2");
Assert.That(2, Is.EqualTo(nameValueCollection.Count));
}
示例5: GetCurrentUser
public User GetCurrentUser(bool fetchMembeships = false, bool fetchGroups = false)
{
var include = string.Empty;
include.Add(fetchMembeships, "memberships");
include.Add(fetchGroups, "groups");
var parameters = new NameValueCollection();
parameters.AddIfNotNullOrEmpty("include", include);
return RedmineService.GetCurrentUser(parameters);
}