Ivan
Ivan

Reputation: 101

HP Quality Center 11 OTA API - How implement the IList2 interface

I am developing an application to extract all entities from a Quality Center project that matches with certain filter.

For this I am loading the entities on a TDAPIOLELib.List object.

This is an extract from the method that performs the action.

_RequirementsList = null;

RequirementsFactory = _TDC.ReqFactory as ReqFactory;
TDFilter TDFilter = RequirementsFactory.Filter as TDFilter;

TDFilter["RQ_USER_01"] = "Y";

_RequirementsList = RequirementsFactory.NewList(TDFilter.Text);

This method also works for refresh the list "_RequirementsList" to have the list updated.

The issue is that as I constantly use this list and others list objects, I need to clear the list each time I use it in other process.

In the HP ALM OTA API reference mentions the "IList2" Interface that adds to the IList interface missing basic functionality, as the Clear() method.

How can I implement the IList2 Interface on a regular List object, in order to have access to the original methods of list and also to the Clear() method included in the interface?

Upvotes: 1

Views: 1111

Answers (1)

Ivan
Ivan

Reputation: 101

Now I figured out. Implementing the IList2 interface is as easy as specifying the returning type:

IList2 _RequirementsList2 = RequirementsFactory.NewList(TDFilter.Text) as IList2;

You can use either IList or IList2 to get the result properly of the above sentence, the funny part is that using the IList2 interface you have access to the Clear() method but not to the full method list of the IList interface (Add(), Count, etc).

This is something that can be improved in the HP ALM OTA API.

Upvotes: 2

Related Questions