The following C # code failed to execute
I searched for a lot of information but couldn't find the problem
The code below is C# 4.0 version, Using linqpad5 can execute successfully
Cannot include extension methods? (.Concat .Skip)
Macro M1
I searched for a lot of information but couldn't find the problem

The code below is C# 4.0 version, Using linqpad5 can execute successfully
Cannot include extension methods? (.Concat .Skip)
Macro M1
_s=
;using System;
;using System.Linq;
;using System.Collections.Generic;
;using System.Text.RegularExpressions;
;
;public class cs
;{
;,public static void Main()
;,{
;,,string s = "xzc abc(s \"(abc)\")); dfg()";
;,,string p = @"abc\(((?:(?>[^()]*)|\((?<Open>)|\)(?<-Open>))*(?(Open)(?!)))\)";
;,,string[] result = matches(s, p);
;,,Console.WriteLine("Full match: {0}", result[0]);
;,,Console.WriteLine("Group matches: {0}", string.Join(", ", result.Skip(1)));
;,}
;,
;,public static string[] matches(string s, string pattern)
;,{
;,,Match match = Regex.Match(s, pattern);
;,,string fullMatch = match.Value;
;
;,,string[] groupMatches = null;
;,,if (match.Groups.Count > 1)
;,,{
;,,,groupMatches = new string[match.Groups.Count - 1];
;,,,for (int i = 1; i < match.Groups.Count; i++)
;,,,{
;,,,,groupMatches[i - 1] = match.Groups[i].Value;
;,,,}
;,,}
;,,return groupMatches == null ? new string[] { fullMatch } : new string[] { fullMatch }.Concat(groupMatches).ToArray();
;,}
;}
CsScript x.AddCode(_s)
x.Call("Main")