.NET Framework 4.7.2. Visual Studio 2019. This issue is not specifically addressed in other posts about this error.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Stuff
{
class Program
{
static void Main(string[] args)
{
string firstPart = "ABC 123 XYZ";
string firstPartMinusLast = string.Join(" ", firstPart.Split(' ').SkipLast(1));
Console.WriteLine(firstPartMinusLast);
}
}
}
I get an Intellisense error on SkipLast
:
string[] does not contain a definition for 'SkipLast' and no accessible extension method 'SkipLast' accepting a first argument of type 'string[]' could be found (are you missing a using directive or an assembly reference?)
Per any documentation I can find online, using System.Linq
is supposed to cover this method?