@OriginalGriff is right, the Substring method do that one parameter. That case it will treat the parameter as start index. Try debug the code to see what in the HOF. The length of HOF must be 3 or more according to what posted here.
Example below will output:
cde because 5 - 3 = 2, it will start to read from position 2 (0,1,2,3,4) which is c.
object HOF = "abcde";
string pHOF = HOF.ToString().Substring(Convert.ToString(HOF).Length - 3);
Example below will output:
StartIndex cannot be less than zero. Parameter name: startIndex because 2 - 3 = -1, the startIndex must be 0 or more.
object HOF = "ab";
string pHOF = HOF.ToString().Substring(Convert.ToString(HOF).Length - 3);
As the error mentioned, the substring method is missing the start index. It should be substring(startinxex, endindex). In your scenario, it would be something like .Substring(0, a.HOF.Length -3)
c - Google Search[^]