C# 获取字符串中某段字符,写一个方法

方法
(参数1 字符串内容,参数2,参数1中的某些字符,参数3 左\右,参数4 长度)

举例:
string str = "爸爸给我买了一盆仙人掌,它的刺可扎手了!但是它圆的像太阳。我每天给它浇水,我可喜欢它了!我还用一个漂亮的盆子来养它。我妈妈还特地为它买一些营养土。我真喜欢仙人掌。";

方法:(str,"仙人掌",左,2);
输出:一盆、喜欢
求大佬们给些这样的一个方法

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Q768970
{
    class Program
    {
        static string 方法(string str, string s, string pos, int len)
        {
            string esc = "\\()[]-=+*,.\"'!^$?<>{}";
            foreach (var item in esc)
                s = s.Replace(item.ToString(), "\\" + item.ToString());
            string pattern = s + "(.{" + len.ToString() + "})";
            if (pos == "左")
                pattern = "(.{" + len.ToString() + "})" + s;
            return string.Join("、", Regex.Matches(str, pattern, RegexOptions.Multiline)
                .Cast<Match>()
                .Select(x => x.Groups[1].Value));
        }

        static void Main(string[] args)
        {
            string str = "爸爸给我买了一盆仙人掌,它的刺可扎手了!但是它圆的像太阳。我每天给它浇水,我可喜欢它了!我还用一个漂亮的盆子来养它。我妈妈还特地为它买一些营养土。我真喜欢仙人掌。";
            string result = 方法(str, "仙人掌", "左", 2);
            Console.WriteLine(result);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
class Program
{

    static void Main(string[] args)
    {
        string str = "爸爸给我买了一盆仙人掌,它的刺可扎手了!但是它圆的像太阳。我每天给它浇水,我可喜欢它了!我还用一个漂亮的盆子来养它。我妈妈还特地为它买一些营养土。我真喜欢仙人掌。";
        var strs = Demo.getStrs(str, "仙人掌", Direction.Right, 2);
        foreach (var item in strs)
        {
            Console.WriteLine(item);
        }
        Console.ReadKey();
    }
}
public class Demo
{
    public static List<String> getStrs(String source, String key, Direction direction, int length)
    {
        List<String> result = new List<string>();
        if (!String.IsNullOrWhiteSpace(source) && !String.IsNullOrWhiteSpace(key))
        {
            int keyIndex = source.IndexOf(key);
            while (keyIndex > -1)
            {
                switch (direction)
                {
                    case Direction.Left:
                        result.Add(source.Substring(keyIndex - length, length));
                        break;
                    case Direction.Right:
                        if ((keyIndex + key.Length + length) > source.Length)
                        {
                            result.Add(source.Substring(keyIndex + key.Length, (source.Length - (keyIndex + key.Length ))));
                        }
                        else {
                            result.Add(source.Substring(keyIndex + key.Length, length));
                        }

                        break;
                    default:
                        break;
                }
                keyIndex = source.IndexOf(key, keyIndex + 1);
            }
        }
        return result;
    }
}

public enum Direction
{
    Left,
    Right
}

}