How could I run a function written as a string in C#?

I am creating a dialogue system that iterates through the lines of a txt file and I want writers to quickly create a sort of "if" statement to evaluate comparisons and call functions within the string to get certain values to be compared.

The most recent direct answer to this question that I could find is here but I haven't tested it: https://www.codeproject.com/Articles/11939/Evaluate-C-Code-Eval-Function but the "CreateCompiler()" function has depreciated so I'm assuming that there must be some sort of alternative since 2006? I'd probably end up using that solution if there it isn't that big of a problem to use depreciated functions.

here is a simple representation of what i am trying to do:

using System;

public static class SomeClass
{
    static int somevalue = 78;
    public static int GetSomeValue()
    {
        return somevalue;
    }
}



public class Program
{



    //this would be extracted from a line in a text "dialogue" file and would be inserted into a function constructed around it. 
    static string boolString = "SomeClass.GetSomeValue() >= 50";



    public static void Main()
    {
        //I'm just assuming based on the 2006 way of doing this that i'd have to build around the string with a function before reading it as code.
        string FunctString = "public static void StringFunct(){ if("+ boolString +"){ return true;}else{return false;}}";

        //i'd maybe also need to build a class around it too.
        string ClassString = "public Class StringClass(){using System; /*...*/"+ FunctString +"}";

        if (GenerateCodeFromStringAndReturnBool(ClassString))
        {
            Console.WriteLine("yeet");
        }

    }

    public static bool GenerateCodeFromStringAndReturnBool(string code)
    {
        bool result = false;
        //some way to turn the string into code and run StringFunct() within it from here

        return result;
    }
}

Any answers/suggestions would be appreciated.