In Visual FoxPro. there is a function addbs(), to which you pass a string.
If there is not a backslash at the end of the (trimmed) string, it will add one. If there is a backslash, it will return the trimmed string.
lcString = 'C:\Example'
lcNewString = addbs(lcString)
?lcNewString
Output:
C:\Example\
Is there an equivalent function in C#?