Using directives

The Using statements are added to improve the code readability.

Adding the namespace as a using statement saves the developer from writing the namespace in the code before each method.

For example:

Instead of typing:

System.Windows.Forms.MessageBox.Show("Test"); 

We can add

using System.Windows.Forms; 

at the top of the file and then just to type:

MessageBox.Show("Text to be Displayed"); 
using System.Windows.Forms;
namespace Northwind.Training
{
    class HelloWorld
    {
       public void Run()
       {
-           System.Windows.Forms.MessageBox.Show("Hello World", "Hello World Caption", System.Windows.Forms.MessageBoxButton.OK);
            MessageBox.Show("Hello World", "Hello World Caption", MessageBoxButton.OK);
       }     
    }
} 
  1. Note: The “using” keyword has more usages and meanings that will be covered later.

Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com