R
Rob
Hi all,
I wrote myself a little function to do my own housekeeping, I can call
it by using
Dispose(object)
Within this function there's a select case statement which will then,
based on some flags and the type of the object do things like close
connections, dispose of the object where appropriate and so on.
Here's my question....
I have various functions where I'll do something like this:
create a connection
create a command
create an adapter
create a datatable
fill the datatable via the adapter
Dispose(adapter)
Dispose(command)
Dispose(connection)
return datatable
Now - this is all well and good - but obviously I cant tidy up my
datatable or else I'd have nothing to return....
I'm sure the .net garbage thingy-majig tages care of it - but in an
anal way I like to do all of my own clearing up....so, how can I change
my functions to tidy up but still return objects? Presumably, I'd have
to have passed the datatable in ByRef in the first place, thus not
needing to dispose of it in the function, and then clear it away when
I'm done with it from the calling code...
Any other ideas?
Thanks in advance for your help...
Rob
I wrote myself a little function to do my own housekeeping, I can call
it by using
Dispose(object)
Within this function there's a select case statement which will then,
based on some flags and the type of the object do things like close
connections, dispose of the object where appropriate and so on.
Here's my question....
I have various functions where I'll do something like this:
create a connection
create a command
create an adapter
create a datatable
fill the datatable via the adapter
Dispose(adapter)
Dispose(command)
Dispose(connection)
return datatable
Now - this is all well and good - but obviously I cant tidy up my
datatable or else I'd have nothing to return....
I'm sure the .net garbage thingy-majig tages care of it - but in an
anal way I like to do all of my own clearing up....so, how can I change
my functions to tidy up but still return objects? Presumably, I'd have
to have passed the datatable in ByRef in the first place, thus not
needing to dispose of it in the function, and then clear it away when
I'm done with it from the calling code...
Any other ideas?
Thanks in advance for your help...
Rob