How does SqlDataAdapter.Fill work?

  • Thread starter Thread starter Matthew Vandergrift
  • Start date Start date
M

Matthew Vandergrift

A general question...

How does the SqlDataAdapter.Fill(DataTable) method modify the contents of
the supplied DataTable without the caller having to specify the parameter as
ref or out?

Thanks!
 
Matthew said:
How does the SqlDataAdapter.Fill(DataTable) method modify the contents of
the supplied DataTable without the caller having to specify the parameter as
ref or out?

:))))

Any class in .net is passed by reference already.
If you specify "ref" and pass some class (DataTable) for example, it
will mean that you passed referrence to referrence, so that caled method
will be able to modify pointer to your class (e.i. it will be able to
change what your variable points to). If you have C/C++ experience you
have more chances to get what I'm talking about :)

Vadim Chekan.
 
Like Vadim mentions, Ref and Out have nothign to do with whehter or not you
are passing a Reference or a Value Type. Very big distinction. You can
pass a Referency Type by Value for instance, and anything you do to modify
what you passed WILL Be changed. This is a huge distinction. Check out
Reference and Value Types on MSDN.

HTH,

Bill
 
Back
Top