1
我在C#中新,写这样的代码:
为什么我的URI格式在c#中不被支持?
const string file ="http://ipaddress/"+"1.jpg";
var fileName = file.Split('\\').Last();
using (var fileStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
var fts = new FileToSend(fileName, fileStream);
await Bot.SendPhotoAsync(update.Message.Chat.Id, fts, "Nice Picture");
}
但在这一行:
using (var fileStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
得到这个错误:
URI formats are not supported
我该如何解决这个问题?谢谢。
请参阅此问题的答案:http://stackoverflow.com/questions/3460503/how-to-read-a-file-from-a-uri-using-streamreader – Sparrow
为什么在“/”时分裂没有在你的源字符串中? – pinkfloydx33