Advertisement
amironov73

Simplest exception catching with printing stacktrace

Jan 20th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. using ManagedClient;
  4.  
  5. class Program
  6. {
  7.     static void Main()
  8.     {
  9.         try
  10.         {
  11.             string connectionString = "host=127.0.0.1;port=6666;user=1;password=1";
  12.  
  13.             using (ManagedClient64 client = new ManagedClient64())
  14.             {
  15.                 client.ParseConnectionString(connectionString);
  16.                 client.Connect();
  17.  
  18.                 int maxMfn = client.GetMaxMfn();
  19.                 Console.WriteLine("Max MFN={0}", maxMfn);
  20.             }
  21.         }
  22.         catch (Exception exception)
  23.         {
  24.             Console.WriteLine("Exception occurred: {0}", exception);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement