下载NuGet包:Microsoft.WindowsAPICodePack-Shell
添加引用:using Microsoft.WindowsAPICodePack.Shell;
以下为获取照片时间的方法:
public string GetMediaTimeLen(string path)
{
var file = path;
ShellObject obj = ShellObject.FromParsingName(file);
var takenDate = obj.Properties.System.ItemDate.Value;
return takenDate.ToString();
}