QuoteI now think that changing the whole method is an overkill
And that's exactly what transpilers are for . Altering a specific and small part of a method, rather than the entire method.
Your second codeblock is B18. 1.0 already has a loop, you'll want to take that into account.
Write in C# what you envision the end-result should look like or carefully explain it.