- Reuse by Inheritance or Containment
- Wrapping a DataSet
- Direct Use of a Generic Container Datatype
- Some Pros and Cons with the Wrap Solution
- Wrapped DataSet Code Examples
- Hashtable Code Examples
- Tests of the Week
- Conclusion
Some Pros and Cons with the Wrap Solution
The advantages and disadvantages depend on what datatype you wrap. Because I'm here wrapping the DataSet, the pros and cons are the same. But there are more. These are the pros:
The wrapped DataSet can be tailored to your needs.
Type-safe operations typically are involved.
It's possible to use it with minimal interface.
And here are the cons:
The wrapped DataSet requires some extra work.
You need to break encapsulation to get rich built-in data binding, such as sorting and filtering.
Likewise, when directly using a generic container datatype, the pros and cons are highly dependent on what datatype you choose. Here are the pros:
A generic container datatype is untyped (but I seldom find that an advantage).
Overall performance is very good for this solution.
And here are the cons:
Using a generic container datatype often feels like a hack.
It's untyped.
It's weak for integration with heterogeneous clients.
You get what you getyou can't do much about it.