Question

I recently built an API and was often asked to replace the StringCollections i was returning by objects containing a single property, The reason being that it was easier to bind with a listview or other controls in ASP.Net.

Since the API was used by the web application, the Web service and the dataloader I decided on keeping the StringCollection as my return type.

The methods returned labels for groups or report names.

Did I make the right choice? In such a situation how do you go about justifying your choice?

Was it helpful?

Solution

I don't think you should make your API more complicated than needed just to satisfy the limitations a data binding module.

But you could perhaps provide a wrapper class for a StringCollection that adapted it to the demands of the data binding module?

Edit: This wrapper should be considered part of the data-binding layer rather than your data API, since it is something created specifically to adapt to the databinding module. It is irrelevant to other consumers of your data (if I understand your description correctly).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top