public string GetBodyText(int howManySpacesInOutsideBody = 0, int additionalSpaces = 0) { string spacesForCodeLine = string.Empty; for (int i = 0; i < howManySpaces - howManySpacesInOutsideBody + additionalSpaces; i++) { spacesForCodeLine += ' '; } List <string> _resultWithWhiteSpaces = new List <string>(this.code.Split('\n')); while (_resultWithWhiteSpaces.Count > 0 && _resultWithWhiteSpaces[0].Trim() == string.Empty) { _resultWithWhiteSpaces.RemoveAt(0); } while (_resultWithWhiteSpaces.Count > 0 && _resultWithWhiteSpaces[_resultWithWhiteSpaces.Count - 1].Trim() == string.Empty) { _resultWithWhiteSpaces.RemoveAt(_resultWithWhiteSpaces.Count - 1); } string result = string.Empty; PutVariablesToCode(ref result, spacesForCodeLine); foreach (string codeLine in _resultWithWhiteSpaces) { result += spacesForCodeLine + codeLine + '\n'; } if (constructionType == ConstructionType.Function && Converter.FindIndexOfActStartIgnoringBrackets(header, "dynamic").Length != 0) { string[] _resultAsLinesList = result.Split('\n'); if (_resultAsLinesList.Length >= 2 && Converter.FindIndexOfActStartIgnoringBrackets(_resultAsLinesList[_resultAsLinesList.Length - 2], "return").Length == 0) { result += "\n" + spacesForCodeLine + "return null;" + "\n"; } } result = "{\n" + result + "}\n\n"; if (header != null) { header = header.TrimEnd(';', '\n'); result = header + "\n" + result; } return(result); }