如何使用Platform :: String检查文件的扩展名?

时间:2014-07-08 17:08:53

标签: windows-store-apps

我试图检查StorageFile是否是zip文件。 我可以将StorageFile转换为它的全名,包括它的扩展名。

然而,我可以使用Platform :: String中的非常有用的方法来检查文件扩展名。

2 个答案:

答案 0 :(得分:0)

鉴于名称,我希望Path.GetExtension能为您效劳,如果您正在使用.NET"查看" WinRT。 (我不知道WinRT本身是否直接相当。现在看。)

答案 1 :(得分:0)

在StorageFile对象上,有一个名为FileType的方法。 这将检索StorageFile的扩展Platform :: String。

离。 String ^ extension = storageFile-> FileType;