+ 1
Please let me know why this error is coming here
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static string myMessage() { return "Hi"; } static void Main(string[] args) { string message = myMessage; Console.WriteLine(message); } } }
3 Respostas
+ 2
It should be:
string message = myMessage();
You have written myMessage as a function, and functions should be followed by brackets.
+ 1
myMessage()
need parenthesis to execute the function ~
0
Thank you so much