none
error: system.console.write (string) is a method but like a type

    Question

  • using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace Methods
    {
        class Program
        {
            static void showMessage(string Param);
            {
            Console.Write("Hello Mr: "+ Param);
            }
            static void Main(string[] args)
            {
                showMessage("Khalid");
                console.readkey();
            }
        }
    }
    Friday, February 09, 2018 8:08 PM

All replies

  • Remove the sixth ‘;’ and also change to ‘Console.ReadKey’.

    • Proposed as answer by Tim RobertsMVP Friday, February 09, 2018 10:25 PM
    Friday, February 09, 2018 8:30 PM
  • Hello taha1220,

    The final result like below.

    using System;
    
    namespace Error_message
    {
        class Program
        {
            static void showMessage(string Param)
            {
                Console.Write("Hello Mr: " + Param);
            }
            static void Main(string[] args)
            {
                showMessage("Khalid");
                Console.ReadKey();
            }
        }
    }
    

    If you have any issues, please feel free to contact me.

    Best regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 12, 2018 8:10 AM
    Moderator