Jon Skeet wrote:
Rick <rrquick@nospam-com> wrote:
Why have the DataSet in Form A at all? Why not have an independant class
(a singleton) that holds the DataSet and shares it across Form A and
Form B?
I don't see why a singleton is needed here at all. I would suggest
creating a new instance of the independent class, and passing a
reference to that instance to the constructors of both Form A and Form
B. Using a singleton avoids the need for that reference, but could
prove restrictive later on.
True, I did think about that but then I can't think of a reason why (in
her situation) she would want to keep an instance being passed around
for a convenient class wrapping the DataSet. Her requirement was to keep
it consistent by making any change in another form reflect back to the
other (or others). Since it's only a DataSet and not a user defined
class which could grow into something more meaningful or useful,
requiring separate instances, I believe a singleton is probably the
best, clean choice. Then again, that's only my honest opinion :)
Rick