I am working on a legacy application, and when the datatable that would be bound to the DataSource is empty (i.e. has no rows), the DataSource is instead bound to Nothing.
I would expect this to give a neligible performance increase at best, and I can’t think of any other reason to do this.
Is there something I’m missing? Is there either a behaviorial or significant performance difference beween a datasource that has no rows versus a datasource that is null?
UPDATE: The columns are being defined in the aspx, not autogenerated.
Depending on how you are specifying the column definitions (ie: either having them being generated on the fly or before hand) you may have a visual difference in the grid layout (A grid with source of nothing will obviously not auto-generate the the columns). However strictly speaking from a memory management and performance perspective I would think that the null dataset/datatable would be have a lower footprint because you would not cause the grid to fire its dataset initialization events.
In the grand scheme of things, I don’t think you’d actually see much of a measurable time / memory difference either way unless your routine to create the empty dataset/datatable takes a significant amount of time.
I’d love to hear other folks opinions on the topic.