1、EnsureEndsWith(char c)
Adds a char to end of given string if it does not ends with the char.
使用示例:
string url = baseUrl.EnsureEndsWith('/') + route;
說明:如果字符串最后不是該字符,則增加這個字符到字符串的最后。適用於路徑,因為不明確路徑的最后是否是/,使代碼更加優雅。
2、Combine(string path1, string path2)
Combines two strings into a path.
使用示例:var filePath = Path.Combine(uploads, file.FileName);
