0

I'm using TFS API to get Work Item Collection and then in a DataTable i made Workitem properties like WorkItem Id,Title,Type,State,Assigned To...etc as it's columns. Now in a foreach loop i'm adding the data of WorkItem collection into DataRows. Some of my colleagues saying that this is not a recommended approach and they are advising to Create a Class for WorkItems. nowcan somebody tell me what to do in this scenario.I'm not asking for syntax but for the approach here.I'm a new bee to C#.

Jaganmohanreddy
  • 391
  • 4
  • 19
  • Ask your colleagues.. they have a better understanding of your use case than we do.. Can you expand your question a little bit? – Simon Whitehead Nov 22 '14 at 05:51
  • @SimonWhitehead thanks for the quick reply.Here my use case is nothing but to automate the process of sending mail notifications to Tfs users regarding their work items status. For that to get and store tfs work item data i'm using DataTables.Is that a best practice to do that.? – Jaganmohanreddy Nov 22 '14 at 06:04

1 Answers1

1

What they probably saying is that you can create a datastructure for your workitem. For example a class like below, which you can manipulate based on your need.

public class MyCustomWorkItem
{
    public string WorkItemID {get; set;}

    public string Description { get; set; }

    // and so on
}

And then you can build a collection of this type of object from the WorkItemCollection received from TFS.

Piyush Parashar
  • 866
  • 8
  • 20
  • Thanks @Piyush for the quick reply.Now will it give any performance benifits than this DataTable or its just best case scenario? Pardon me if my question is not up to the mark but i'm very absolute beginer in C# & Software Development. After all i think this is the way(asking people like you) to gain knowledge about Concepts. – Jaganmohanreddy Nov 22 '14 at 06:09
  • You said you in the comment of your question that you want to notify people about workitem status through email. That can be done using alerts in TFS right? I just want to know the scenarios you are working on so that I can comment. – Piyush Parashar Nov 22 '14 at 16:22