本文整理汇总了C#中IDictionary.GetValueAsCollection方法的典型用法代码示例。如果您正苦于以下问题:C# IDictionary.GetValueAsCollection方法的具体用法?C# IDictionary.GetValueAsCollection怎么用?C# IDictionary.GetValueAsCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDictionary
的用法示例。
在下文中一共展示了IDictionary.GetValueAsCollection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
/// <summary>
/// When overridden in a derived class, converts the provided dictionary into an object of the specified type.
/// </summary>
/// <param name="dictionary">
/// An <see cref="T:System.Collections.Generic.IDictionary`2" /> instance of property data stored
/// as name/value pairs.
/// </param>
/// <param name="type">The type of the resulting object.</param>
/// <param name="serializer">The <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer" /> instance.</param>
/// <returns>
/// The deserialized object.
/// </returns>
public override object Deserialize(IDictionary<string, object> dictionary, Type type,
JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var user = new User();
user.Login = dictionary.GetValue<string>(RedmineKeys.LOGIN);
user.Id = dictionary.GetValue<int>(RedmineKeys.ID);
user.FirstName = dictionary.GetValue<string>(RedmineKeys.FIRSTNAME);
user.LastName = dictionary.GetValue<string>(RedmineKeys.LASTNAME);
user.Email = dictionary.GetValue<string>(RedmineKeys.MAIL);
user.AuthenticationModeId = dictionary.GetValue<int?>(RedmineKeys.AUTH_SOURCE_ID);
user.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
user.LastLoginOn = dictionary.GetValue<DateTime?>(RedmineKeys.LAST_LOGIN_ON);
user.ApiKey = dictionary.GetValue<string>(RedmineKeys.API_KEY);
user.Status = dictionary.GetValue<UserStatus>(RedmineKeys.STATUS);
user.MustChangePassword = dictionary.GetValue<bool>(RedmineKeys.MUST_CHANGE_PASSWD);
user.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
user.Memberships = dictionary.GetValueAsCollection<Membership>(RedmineKeys.MEMBERSHIPS);
user.Groups = dictionary.GetValueAsCollection<UserGroup>(RedmineKeys.GROUPS);
return user;
}
return null;
}
示例2: Deserialize
/// <summary>
/// Deserializes the specified dictionary.
/// </summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="type">The type.</param>
/// <param name="serializer">The serializer.</param>
/// <returns></returns>
public override object Deserialize(IDictionary<string, object> dictionary, Type type,
JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var customField = new CustomField();
customField.Id = dictionary.GetValue<int>(RedmineKeys.ID);
customField.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
customField.CustomizedType = dictionary.GetValue<string>(RedmineKeys.CUSTOMIZED_TYPE);
customField.FieldFormat = dictionary.GetValue<string>(RedmineKeys.FIELD_FORMAT);
customField.Regexp = dictionary.GetValue<string>(RedmineKeys.REGEXP);
customField.MinLength = dictionary.GetValue<int?>(RedmineKeys.MIN_LENGTH);
customField.MaxLength = dictionary.GetValue<int?>(RedmineKeys.MAX_LENGTH);
customField.IsRequired = dictionary.GetValue<bool>(RedmineKeys.IS_REQUIRED);
customField.IsFilter = dictionary.GetValue<bool>(RedmineKeys.IS_FILTER);
customField.Searchable = dictionary.GetValue<bool>(RedmineKeys.SEARCHABLE);
customField.Multiple = dictionary.GetValue<bool>(RedmineKeys.MULTIPLE);
customField.DefaultValue = dictionary.GetValue<string>(RedmineKeys.DEFAULT_VALUE);
customField.Visible = dictionary.GetValue<bool>(RedmineKeys.VISIBLE);
customField.PossibleValues =
dictionary.GetValueAsCollection<CustomFieldPossibleValue>(RedmineKeys.POSSIBLE_VALUES);
customField.Trackers = dictionary.GetValueAsCollection<TrackerCustomField>(RedmineKeys.TRACKERS);
customField.Roles = dictionary.GetValueAsCollection<CustomFieldRole>(RedmineKeys.ROLES);
return customField;
}
return null;
}
示例3: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var project = new Project();
project.Id = dictionary.GetValue<int>(RedmineKeys.ID);
project.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
project.HomePage = dictionary.GetValue<string>(RedmineKeys.HOMEPAGE);
project.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
project.Identifier = dictionary.GetValue<string>(RedmineKeys.IDENTIFIER);
project.Status = dictionary.GetValue<ProjectStatus>(RedmineKeys.STATUS);
project.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
project.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
project.Trackers = dictionary.GetValueAsCollection<ProjectTracker>(RedmineKeys.TRACKERS);
project.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
project.IsPublic = dictionary.GetValue<bool>(RedmineKeys.IS_PUBLIC);
project.Parent = dictionary.GetValueAsIdentifiableName(RedmineKeys.PARENT);
project.IssueCategories = dictionary.GetValueAsCollection<ProjectIssueCategory>(RedmineKeys.ISSUE_CATEGORIES);
project.EnabledModules = dictionary.GetValueAsCollection<ProjectEnabledModule>(RedmineKeys.ENABLED_MODULES);
return project;
}
return null;
}
示例4: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var project = new Project();
project.Id = dictionary.GetValue<int>("id");
project.Description = dictionary.GetValue<string>("description");
project.HomePage = dictionary.GetValue<string>("homepage");
project.Name = dictionary.GetValue<string>("name");
project.Identifier = dictionary.GetValue<string>("identifier");
project.Status = dictionary.GetValue<ProjectStatus>("status");
project.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
project.UpdatedOn = dictionary.GetValue<DateTime?>("updated_on");
project.Trackers = dictionary.GetValueAsCollection<ProjectTracker>("trackers");
project.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>("custom_fields");
project.IsPublic = dictionary.GetValue<bool>("is_public");
project.Parent = dictionary.GetValueAsIdentifiableName("parent");
project.IssueCategories = dictionary.GetValueAsCollection<ProjectIssueCategory>("issue_categories");
project.EnabledModules = dictionary.GetValueAsCollection<ProjectEnabledModule>("enabled_modules");
return project;
}
return null;
}
示例5: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var customField = new CustomField();
customField.Id = dictionary.GetValue<int>("id");
customField.Name = dictionary.GetValue<string>("name");
customField.CustomizedType = dictionary.GetValue<string>("customized_type");
customField.FieldFormat = dictionary.GetValue<string>("field_format");
customField.Regexp = dictionary.GetValue<string>("regexp");
customField.MinLength = dictionary.GetValue<int?>("min_length");
customField.MaxLength = dictionary.GetValue<int?>("max_length");
customField.IsRequired = dictionary.GetValue<bool>("is_required");
customField.IsFilter = dictionary.GetValue<bool>("is_filter");
customField.Searchable = dictionary.GetValue<bool>("searchable");
customField.Multiple = dictionary.GetValue<bool>("multiple");
customField.DefaultValue = dictionary.GetValue<string>("default_value");
customField.Visible = dictionary.GetValue<bool>("visible");
customField.PossibleValues = dictionary.GetValueAsCollection<CustomFieldPossibleValue>("possible_values");
customField.Trackers = dictionary.GetValueAsCollection<TrackerCustomField>("trackers");
customField.Roles = dictionary.GetValueAsCollection<CustomFieldRole>("roles");
return customField;
}
return null;
}
示例6: Deserialize
/// <summary>
/// When overridden in a derived class, converts the provided dictionary into an object of the specified type.
/// </summary>
/// <param name="dictionary">
/// An <see cref="T:System.Collections.Generic.IDictionary`2" /> instance of property data stored
/// as name/value pairs.
/// </param>
/// <param name="type">The type of the resulting object.</param>
/// <param name="serializer">The <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer" /> instance.</param>
/// <returns>
/// The deserialized object.
/// </returns>
public override object Deserialize(IDictionary<string, object> dictionary, Type type,
JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var timeEntry = new TimeEntry();
timeEntry.Id = dictionary.GetValue<int>(RedmineKeys.ID);
timeEntry.Activity =
dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey(RedmineKeys.ACTIVITY)
? RedmineKeys.ACTIVITY
: RedmineKeys.ACTIVITY_ID);
timeEntry.Comments = dictionary.GetValue<string>(RedmineKeys.COMMENTS);
timeEntry.Hours = dictionary.GetValue<decimal>(RedmineKeys.HOURS);
timeEntry.Issue =
dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey(RedmineKeys.ISSUE)
? RedmineKeys.ISSUE
: RedmineKeys.ISSUE_ID);
timeEntry.Project =
dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey(RedmineKeys.PROJECT)
? RedmineKeys.PROJECT
: RedmineKeys.PROJECT_ID);
timeEntry.SpentOn = dictionary.GetValue<DateTime?>(RedmineKeys.SPENT_ON);
timeEntry.User = dictionary.GetValueAsIdentifiableName(RedmineKeys.USER);
timeEntry.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
timeEntry.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
timeEntry.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
return timeEntry;
}
return null;
}
示例7: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var group = new Group();
group.Id = dictionary.GetValue<int>("id");
group.Name = dictionary.GetValue<string>("name");
group.Users = dictionary.GetValueAsCollection<User>("users");
group.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>("custom_fields");
group.Memberships = dictionary.GetValueAsCollection<Membership>("memberships");
return group;
}
return null;
}
示例8: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var group = new Group();
group.Id = dictionary.GetValue<int>(RedmineKeys.ID);
group.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
group.Users = dictionary.GetValueAsCollection<GroupUser>(RedmineKeys.USERS);
group.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
group.Memberships = dictionary.GetValueAsCollection<Membership>(RedmineKeys.MEMBERSHIPS);
return group;
}
return null;
}
示例9: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
User user = new User();
user.Login = dictionary.GetValue<string>("login");
user.Id = dictionary.GetValue<int>("id");
user.FirstName = dictionary.GetValue<string>("firstname");
user.LastName = dictionary.GetValue<string>("lastname");
user.Email = dictionary.GetValue<string>("mail");
user.AuthenticationModeId = dictionary.GetValue<int?>("auth_source_id");
user.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
user.LastLoginOn = dictionary.GetValue<DateTime?>("last_login_on");
user.ApiKey = dictionary.GetValue<string>("api_key");
user.Status = dictionary.GetValue<UserStatus>("status");
user.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>("custom_fields");
user.Memberships = dictionary.GetValueAsCollection<Membership>("memberships");
user.Groups = dictionary.GetValueAsCollection<UserGroup>("groups");
return user;
}
return null;
}
示例10: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var role = new Role();
role.Id = dictionary.GetValue<int>("id");
role.Name = dictionary.GetValue<string>("name");
role.Permissions = dictionary.GetValueAsCollection<Permission>("permissions");
return role;
}
return null;
}
示例11: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var membership = new Membership();
membership.Id = dictionary.GetValue<int>(RedmineKeys.ID);
membership.Project = dictionary.GetValueAsIdentifiableName(RedmineKeys.PROJECT);
membership.Roles = dictionary.GetValueAsCollection<MembershipRole>(RedmineKeys.ROLES);
return membership;
}
return null;
}
示例12: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var projectMembership = new ProjectMembership();
projectMembership.Id = dictionary.GetValue<int>("id");
projectMembership.Group = dictionary.GetValueAsIdentifiableName("group");
projectMembership.Project = dictionary.GetValueAsIdentifiableName("project");
projectMembership.Roles = dictionary.GetValueAsCollection<MembershipRole>("roles");
projectMembership.User = dictionary.GetValueAsIdentifiableName("user");
return projectMembership;
}
return null;
}
示例13: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var journal = new Journal();
journal.Id = dictionary.GetValue<int>("id");
journal.Notes = dictionary.GetValue<string>("notes");
journal.User = dictionary.GetValueAsIdentifiableName("user");
journal.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
journal.Details = dictionary.GetValueAsCollection<Detail>("details");
return journal;
}
return null;
}
示例14: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var journal = new Journal();
journal.Id = dictionary.GetValue<int>(RedmineKeys.ID);
journal.Notes = dictionary.GetValue<string>(RedmineKeys.NOTES);
journal.User = dictionary.GetValueAsIdentifiableName(RedmineKeys.USER);
journal.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
journal.Details = dictionary.GetValueAsCollection<Detail>(RedmineKeys.DETAILS);
return journal;
}
return null;
}
示例15: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var issue = new Issue();
issue.Id = dictionary.GetValue<int>(RedmineKeys.ID);
issue.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
issue.Project = dictionary.GetValueAsIdentifiableName(RedmineKeys.PROJECT);
issue.Tracker = dictionary.GetValueAsIdentifiableName(RedmineKeys.TRACKER);
issue.Status = dictionary.GetValueAsIdentifiableName(RedmineKeys.STATUS);
issue.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
issue.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
issue.ClosedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CLOSED_ON);
issue.Priority = dictionary.GetValueAsIdentifiableName(RedmineKeys.PRIORITY);
issue.Author = dictionary.GetValueAsIdentifiableName(RedmineKeys.AUTHOR);
issue.AssignedTo = dictionary.GetValueAsIdentifiableName(RedmineKeys.ASSIGNED_TO);
issue.Category = dictionary.GetValueAsIdentifiableName(RedmineKeys.CATEGORY);
issue.FixedVersion = dictionary.GetValueAsIdentifiableName(RedmineKeys.FIXED_VERSION);
issue.Subject = dictionary.GetValue<string>(RedmineKeys.SUBJECT);
issue.Notes = dictionary.GetValue<string>(RedmineKeys.NOTES);
issue.IsPrivate = dictionary.GetValue<bool>(RedmineKeys.IS_PRIVATE);
issue.StartDate = dictionary.GetValue<DateTime?>(RedmineKeys.START_DATE);
issue.DueDate = dictionary.GetValue<DateTime?>(RedmineKeys.DUE_DATE);
issue.DoneRatio = dictionary.GetValue<float>(RedmineKeys.DONE_RATIO);
issue.EstimatedHours = dictionary.GetValue<float>(RedmineKeys.ESTIMATED_HOURS);
issue.SpentHours = dictionary.GetValue<float>(RedmineKeys.SPENT_HOURS);
issue.ParentIssue = dictionary.GetValueAsIdentifiableName(RedmineKeys.PARENT);
issue.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
issue.Attachments = dictionary.GetValueAsCollection<Attachment>(RedmineKeys.ATTACHMENTS);
issue.Relations = dictionary.GetValueAsCollection<IssueRelation>(RedmineKeys.RELATIONS);
issue.Journals = dictionary.GetValueAsCollection<Journal>(RedmineKeys.JOURNALS);
issue.Changesets = dictionary.GetValueAsCollection<ChangeSet>(RedmineKeys.CHANGESETS);
issue.Watchers = dictionary.GetValueAsCollection<Watcher>(RedmineKeys.WATCHERS);
issue.Children = dictionary.GetValueAsCollection<IssueChild>(RedmineKeys.CHILDREN);
//easy redmine
issue.ActivityId = dictionary.GetValue<int?>(RedmineKeys.ACTIVITY_ID);
return issue;
}
return null;
}