获取对象引用未设置为对象 C# 的实例?
Getting Object reference not set to an instance of an object C#?
我收到未设置对象实例错误
我的代码和图片附在下面
public class Backlogitem
{
public string Name { get; set; }
public int ID { get; set; }
public string State { get; set; }
// public DateTime? due { get; set; }
public int priorty { get; set; }
public int Size { get; set; }
// public int effort { get; set; }
public int StoryPoints { get; set; }
public string DoneStatus { get; set; }
public string StoryOwner { get; set; }
public string Assignedto { get; set; }
public string StoryAuthor { get; set; }
public string IterationPath { get; set; }
}
工作项目列表图片
其余代码粘贴在此处
https://github.com/akhiljain1611/TFS/blob/master/README.md
您需要先初始化列表 (Issues, Tasks and PBacklog)
,然后才能开始向其中添加项目。我已经使用构造函数完成了它:
public class WorkItemViewModel
{
public int Id { get; set; }
public string Title { get; set; }
public string AssignedTo { get; set; }
public string WorkitemType { get; set; }
public string Priorty { get; set; }
public string IterationPath { get; set; }
public string State { get; set; }
public List<TFSIssue> Issues { get; set; }
public List<TFSTask> Tasks { get; set; }
public List<Backlogitem> PBacklog { get; set;}
public WorkItemViewModel() // Added a public constructor
{
Issues = new List<TFSIssue>();
Tasks = new List<TFSTask>();
PBacklog = new List<Backlogitem>();
}
}
我收到未设置对象实例错误
我的代码和图片附在下面
public class Backlogitem
{
public string Name { get; set; }
public int ID { get; set; }
public string State { get; set; }
// public DateTime? due { get; set; }
public int priorty { get; set; }
public int Size { get; set; }
// public int effort { get; set; }
public int StoryPoints { get; set; }
public string DoneStatus { get; set; }
public string StoryOwner { get; set; }
public string Assignedto { get; set; }
public string StoryAuthor { get; set; }
public string IterationPath { get; set; }
}
工作项目列表图片
https://github.com/akhiljain1611/TFS/blob/master/README.md
您需要先初始化列表 (Issues, Tasks and PBacklog)
,然后才能开始向其中添加项目。我已经使用构造函数完成了它:
public class WorkItemViewModel
{
public int Id { get; set; }
public string Title { get; set; }
public string AssignedTo { get; set; }
public string WorkitemType { get; set; }
public string Priorty { get; set; }
public string IterationPath { get; set; }
public string State { get; set; }
public List<TFSIssue> Issues { get; set; }
public List<TFSTask> Tasks { get; set; }
public List<Backlogitem> PBacklog { get; set;}
public WorkItemViewModel() // Added a public constructor
{
Issues = new List<TFSIssue>();
Tasks = new List<TFSTask>();
PBacklog = new List<Backlogitem>();
}
}