更新时间:2023-02-09 09:03:49
这应该工作:
foreach (var blob in CloudStorageAccount.Parse("YOURCONNECTIONSTRING").GetContainerReference("thecontainer").ListBlobs().OfType<CloudBlockBlob>())
{
if (Path.GetExtension(blob.Uri.AbsoluteUri) == ".mp4")
{
blob.Properties.ContentType = "video/mp4";
}
// repeat ad nauseam
blob.SetProperties();
}
或设置一个字典,所以你不必写一堆if语句。
Or set up a dictionary so you don't have to write a bunch of if statements.