C#: Methods Cheat Sheet

class Program
{
  static void MyMethod() 
  {
    // code to be executed
  }
}

# Call a Methods

using System;

namespace MyApplication
{
  class Program
  {
    static void MyMethod()
    {
      Console.WriteLine("I have a red banana");
    }

    static void Main(string[] args)
    {
      MyMethod();
    }
  }
}

=> output

I have a red banana

Leave a Reply

Your email address will not be published. Required fields are marked *