I'm coding in C# for a group of people, I'm designing the signature of the methods to be coded and I need a way to ensure that people won't modify some parameters they will receive. They receive big structures so they are sent by reference, but I want they to consume the data without modifying the original values. But since the structures are big we don't want to make copies of them.
We can assume they don't want to change the data and we only need to protect them from making mistakes.
What solutions does C# offer?
Here's and example
class MyDataBlok {
List<double> samples;
int someParams;
double lots of other params
}
class MySetOfDataBlock
{
List<MyDataBlock> DataSet;
bool SomeParam;
Double lots of other params;
}
class MethodsToBeCoded
{
ProcessSetOfData( /*some tag defining data as protected*/ MySetOfDataBlock data)
{
//Here I want code that uses data without modifying data
// nor the content on any data.DataSet[i]
}
}