title: how to declare global function or method using c#?
body: <p>Can anyone tell me how to declare a global function in c#, similar to what a <code>Module</code> does in VB.net?
  I need to call a function that can be called in my form1, form2, and form3.</p>
  
  <hr>
  
  <p>i have this code :</p>
  
  <pre><code>using System.Data.OleDb;
  
  namespace XYZ
  {
      public static class Module
      {
          public static void dbConnection()
          {
              OleDbConnection con = new OleDbConnection();
              con.ConnectionString = "provider= microsoft.jet.oledb.4.0;data source=..\\dbCooperative.mdb";
              con.Open();
          }
      }
  }
  </code></pre>
  
  <p>and form1:</p>
  
  <pre><code>using System.Data.OleDb;
  using XYZ;
  
  namespace XYZ
  {
      public partial class frmReports : Form
      {
          public frm1()
          {
              InitializeComponent();
          }
  
          private void frm1_Load(object sender, EventArgs e)
          {
              Module.dbConnection();
              OleDbCommand cm = new OleDbCommand("SELECT * FROM table", con);
          }
      }
  }
  </code></pre>
  
  <p>but i has an error: "The name 'con' does not exist in the current context".</p>