The easiest way that will work in many cases is to make it a partial type, i.e. one class whose source code extends to multiple files. Then you can make one file read-only and the other read-only.
To declare a partial type, you simply use the context keyword partial
in the declaration:
public partial class MyClass
{
void Foo()
{
Bar();
}
void Baz()
{
}
}
public partial class MyClass
{
void Bar()
{
Baz();
}
}
As you can see, it ends as if the source was in a single file - you can run methods declared in a single file without any problems.
source
share