I just noticed that i am able to pass private object to another class by a reference
I would guess this should not be possible but it works fine
Here an example
private static StreamWriter swYandexErrors; // in classA
csLogger.logAnyError(ref swYandexErrors, $"msg", E); // in classA
// in class csLogger
public static void logAnyError(ref StreamWriter swError,
string srError, Exception E = null)
{
lock (swError)
{
swError.WriteLine("");
swError.Flush();
}
}