Side note 1, I thought in c# strings had to be surrounded with " as opposed to ’ ?
Side note 2, I have used Object.ToString() many times before but not System.Convert.ToString(Object) so I looked up the docs and one difference is System.Convert.ToString(Object) will return String.Empty if Object is null while Object.ToString() would throw an exception. I learned something new today - thanks!
You can use simplified string formatting with embedding text… put a dollar sign in front, and then the variables inside curly brackets… like this (and do it all in one line). There is no need to define the string and then assign on the next line:
For more information on String “Interpolation” vs String.Format vs String conversion see:
and
I really like the interpolation method of doing things because it takes the guesswork out, AND it makes for shorter lines of code.
I just realized that your original question may not have been answered… you actually dont need to “Convert” the JobNum field because it is already a string. One other solution is simply:
That said, i would probably still use the interpolation way because I like it better (although according to dotnetperls, simple concatenation is slightly faster (83 milliseconds faster for 1,000,000 cycles)).