[Solved] compile and execute lines of code from txt in C# [closed]


If your intention is just to do string replacement (as in the example lines), and you are able to modify the text list, the best approach would be to provide just the replacement tokens in the list:

.jpg,>JPG<
.gif,>GIF<
.png,>PNG<
.tif,>TIF<

Then your C# code can be modified like this:

for (int l=0; w<listWithLines.Count;l++)
{
    string[] strTokens = listWithLines[l].Split(',');
    // MY LINE
    myData = myData.Replace(strTokens[0], strTokens[1]);
}

solved compile and execute lines of code from txt in C# [closed]