Using Static Method in a Class

Program.cs
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. namespace CustomerOrders  
  7. {  
  8.    class Program  
  9.    {  
  10.       static void Main(string[] args)  
  11.       {  
  12.          Items it = Items.getItem(); //here we are using items.getitem to get the method  
  13.          Console.WriteLine("Name for item is: {0} and item id is {1}", it.itemname, it.itemid);  
  14.          Console.ReadKey();  
  15.       }  
  16.    }  
  17. }  
Items.cs
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. namespace CustomerOrders  
  7. {  
  8.    class Items  
  9.    {  
  10.       public int itemid { getset; }  
  11.       public string itemname { getset; }  
  12.       public static Items getItem()  
  13.       {  
  14.          var newitem = new Items() { itemid = 101, itemname = "Ujjwal Patel" };  
  15.          return newitem;  
  16.       }  
  17.    }  
  18. }