private static void StateExample() { var context1 = new ConnectionContext("Url_1"); context1.Connect(); context1.Read(); context1.Close(); Console.WriteLine(); try { var context2 = new ConnectionContext("Url_2"); context2.Read(); } catch (Exception ex) { Console.WriteLine($"context2: {ex.Message}"); } Console.WriteLine(); try { var context3 = new ConnectionContext("Url_3"); context3.Connect(); context3.Close(); context3.Read(); } catch (Exception ex) { Console.WriteLine($"context3: {ex.Message}"); } Console.WriteLine(); }