I have this code to reveres the words in a sentence.
using System;
class Code
{
public static void Main()
{
string x = "I am Sam";
foreach(var a in x.Split().Reverse())
{
Console.WriteLine(a);
}
}
}
When I compile this code (mono 2.10), I got error CS1501: No overload for methodReverse’ takes 0' arguments error message.
What’s wrong with the code?
Add the
System.Linqnamespace: