Is there away to ensure that the DataTable that my function return is ReadOnly?
No, generally there is no such method or way to make it readonly. Unlike the DataView
which has the property AllowEdit
for this purpose( so you could return a DataView instead).
The only way i see to avoid changes on the table is: try to handle the RowChanged
event and call RejectChanges
afterwards.