This example explains the followings.
  1. static method:
  2. exception with try-catch
  3. goto -- jump statment
using System;
//csc static_void_method.cs
namespace howto_staticmethod
{
public class pass_value
{
public static void stat_data(int n1)
{
Console.WriteLine(" received " + n1 + " Processed " + (n1 + n1));
}
}
class test
{
static void Main()
{
start:
Console.Write("Enter a number : ");
string str = Console.ReadLine();
if(str !="")
{
try
{
int n1 = int.Parse(str);
// to call a static method, you cnat' use any instances of class
//rather call the class, like class_name.static_method_name
pass_value.stat_data(n1);
}
catch(Exception e){
Console.WriteLine("Wrong Data and " + e);
Console.WriteLine("Wrong Data and " + e);
goto start;
}
}
Console.ReadLine();
}
}
}//end of the name space