Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从工作项id中知道工作项类型?_C#_Asp.net_Tfs - Fatal编程技术网

C# 如何从工作项id中知道工作项类型?

C# 如何从工作项id中知道工作项类型?,c#,asp.net,tfs,C#,Asp.net,Tfs,我有工作项id int id =int.Parse(Request.QueryString["ID"],System.Globalization.CultureInfo.CurrentCulture); WorkItem item= DataManager.DevelopmentProject.Store.GetWorkItem(id); 我需要知道什么是工作项类型?(bug、更改请求等)我会使用: var type = item.GetType() if(type == typeof(Bug

我有工作项id

int id =int.Parse(Request.QueryString["ID"],System.Globalization.CultureInfo.CurrentCulture);
WorkItem item= DataManager.DevelopmentProject.Store.GetWorkItem(id);
我需要知道什么是工作项类型?(bug、更改请求等)

我会使用:

var type = item.GetType()
if(type == typeof(Bug))
{
    //Do something
}
...

我是这样解决的

item.Fields["Work Item Type"].Value

它不起作用,我无法使用GetType()获取工作项类型,请提供更多详细信息。GetType()获取对象的类型。有继承吗?当我在类型中运行var type=item.GetType()时,类型有许多字段,但与类型无关。这正是我所做的。。。我评论我的帖子是因为我没有足够的声誉。我知道我试图回答一个没有足够信息的问题,基于我的理解。我不能问他一个问题,所以我提供了一个答案。。。我想帮你,也许我不应该。。。