Tag: object model

可与switch()一起使用的自定义结构/类型

我的一个项目有一个值类型/结构,表示video格式的自定义标识符字符串。 在这种情况下,它将包含一个内容类型字符串,但这可能会有所不同。 我已经使用了一个结构体,因此当它传递时它可以是强类型,并对初始字符串值执行一些健全性检查。 实际的字符串值可以是任何内容,由外部插件库提供,因此数字enum不适用。 public struct VideoFormat { private string contentType; public VideoFormat(string contentType) { this.contentType = contentType; } public string ContentType { get { return this.contentType; } } public override string ToString() { return this.contentType; } // various static methods for implicit conversion to/from strings, and comparisons } 由于存在一些非常常见的格式,我将这些格式暴露为具有默认值的静态只读字段。 public static readonly VideoFormat Unknown […]

使用TFS API,如何查找在Code Review上发表的评论?

我正试图找到一种方法来查找有关TFS2012中的代码审查请求/响应项的详细信息。 我可以通过以下方式查询所有代码审查请求/响应项: const string TfsUri = “http://mytfsserver:8080/tfs/Default ProjectCollection”; var tfs = new TfsTeamProjectCollection(new Uri(TfsUri)); var store = tfs.GetService(); var versionStore = tfs.GetService(); var queryText = “SELECT [System.Id], FROM WorkItems WHERE [System.WorkItemType] = ‘Code Review Request’ or [System.WorkItemType] = ‘Code Review Response'”; var query = new Query(store, queryText); var result = query.RunQuery().OfType(); 这给了我一个WorkItem类型列表。 当我循环遍历result.FirstOrDefault().Fields属性时,它确实给了我一些有关ShelveSet的有用信息,它与Code Review相关,即“Associated Context”。 […]