public void XXX() { using (var fw = new StreamWriter("Kalle.txt")) { fw.WriteLine("Hej hopp"); } using (var mr = new MyResource()) { // .... } }