I am new to c#, so bear with me. I have written a recursive function, but I am getting an odd return value. This is the value I am getting back:
Here is the function. I would appreciate any help.
static string CallBack(string TheInputList, int ThePosition)
{
try
{
var TheList = TheInputList.Split('-').Select(int.Parse).ToList();
int IncrementedPositionValue = TheList.ElementAt(ThePosition) + 1;
TheList[ThePosition] = IncrementedPositionValue;
if (IncrementedPositionValue == 96)
{
for (int i = 1; i <= ThePosition; i++)
{
TheList[i] = 1;
}
int NextPosition = ThePosition + 1;
string TheNewList = CallBack(TheList.ToString(), NextPosition);
return TheNewList;
}
else
{
string TheReturnString = TheList.ToString();
return TheReturnString;
}
}
catch {
TheInputList = TheInputList + "-0";
string TheList = null;
TheList = CallBack(TheInputList, ThePosition);
return TheList;
}