R
rwoo_98
I am trying to pass a reference to a method --SomeMethod. This table
resides in a dataset and I refer to the datatable in the dataset using
an indexer. However when I attempt to do this I get the error message,
"A property or indexer may not be passed as an out or ref parameter?"
Here is the code
SomeMethod(ref ds_User.Tables[1]);
The only way I got it to work is to do the following:
DataTable dt_User;
dt_User = ds_User.Tables[1];
SomeMethod(ref dtUser);
Is there a cleaner method of accomplishing this? I know you VB.Net
allows you to use a property or indexer as a ref when calling a method.
Any idea why C# doesn't?
Thanks in advance.
resides in a dataset and I refer to the datatable in the dataset using
an indexer. However when I attempt to do this I get the error message,
"A property or indexer may not be passed as an out or ref parameter?"
Here is the code
SomeMethod(ref ds_User.Tables[1]);
The only way I got it to work is to do the following:
DataTable dt_User;
dt_User = ds_User.Tables[1];
SomeMethod(ref dtUser);
Is there a cleaner method of accomplishing this? I know you VB.Net
allows you to use a property or indexer as a ref when calling a method.
Any idea why C# doesn't?
Thanks in advance.