I can think of 4 ways instantly
1
- If the string ends with a slash remove it
- Use Path.GetFilename (or numerous other System.IO methods)
2
- Split the string on slashes into an array
- Get the last index of the array
3
- Create a Uri class with it in the constructor
- Use the Segments property
4
- The linq way someone mentioned above