This might sound like a stupid question, but I just happened to stumbled upon this. I know you can use ref
to pass a parameter by reference. But I have this method
public void SaveRecordsIntoTemporaryTable(DataTable objDataTable, string userSessionID)
{
// The objDataTable has 5 columns "Id", "Name", "Tag_1", "Tag_2", "Tag_3"
// Now in here I remove "Tag_1", "Tag_2", and "Tag_3"
objDataTable.Columns.Remove("Tag_1");
objDataTable.Columns.Remove("Tag_2");
objDataTable.Columns.Remove("Tag_3");
...
}
Now I have set a debug point on third line, but after I remove this column "Tag_3"
, and I hover my cursor over objDataTable
in the parameter, the DataTable
it shows also has the columns removed? So, is it getting passed by reference?
UPDATE
Okay, if it is getting passed by reference
, what difference would it make if I use ref
?