I'm not sure if anyone knows where this information might be found (or if it even can be) But I am looking for a deconstruction of the "DataTable" and "DataView" objects.
What I mean is I woudl like to know how the DataTabel object is put together (with DataRow and DataColumn objects) and also how the DataView object is put together. ideally woudl be sample code of how the objects are contructed.
As far as I see,I'm afraid you cannot find such a method in the DataTable——generally speaking,I think in .net framework there are two kinds of disposible way——
1)Implement IDispose interface,this will be Dispose all the managed things。
2)Just use a Deconstrcutor,to destroy all the unmanaged things。
But DataTable doesn't seem to find either of them——Look at its defination in the reflector:
public class DataTable : MarshalByValueComponent, IListSource, ISupportInitializeNotification, ISupportInitialize, ISerializable, IXmlSerializable
So is the DataView——
public class DataView : MarshalByValueComponent, IBindingListView, IBindingList, IList, ICollection, IEnumerable, ITypedList, ISupportInitializeNotification, ISupportInitialize
Really?!The answer is——No!Because either DataTable or DataView has inherits from MarshalByValueComponent,and this class has implemented IDispose——
Considerint it that the deconstructor will be executed at a random time,so when set a "false" inside as as parameter,you can see that all the managed things won't be gabaged again.
Prysson
Member
62 Points
274 Posts
Deconstructing a DataTable
Jun 05, 2012 04:26 PM|LINK
I'm not sure if anyone knows where this information might be found (or if it even can be) But I am looking for a deconstruction of the "DataTable" and "DataView" objects.
What I mean is I woudl like to know how the DataTabel object is put together (with DataRow and DataColumn objects) and also how the DataView object is put together. ideally woudl be sample code of how the objects are contructed.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Deconstructing a DataTable
Jun 07, 2012 02:15 AM|LINK
As far as I see,I'm afraid you cannot find such a method in the DataTable——generally speaking,I think in .net framework there are two kinds of disposible way——
1)Implement IDispose interface,this will be Dispose all the managed things。
2)Just use a Deconstrcutor,to destroy all the unmanaged things。
But DataTable doesn't seem to find either of them——Look at its defination in the reflector:
So is the DataView——
Really?!The answer is——No!Because either DataTable or DataView has inherits from MarshalByValueComponent,and this class has implemented IDispose——
protected virtual void Dispose(bool disposing) { if (disposing) { lock (this) { if ((this.site != null) && (this.site.Container != null)) { this.site.Container.Remove(this); } if (this.events != null) { EventHandler handler = (EventHandler) this.events[EventDisposed]; if (handler != null) { handler(this, EventArgs.Empty); } } } } } ~MarshalByValueComponent() { this.Dispose(false); }Considerint it that the deconstructor will be executed at a random time,so when set a "false" inside as as parameter,you can see that all the managed things won't be gabaged again.