简体   繁体   English

检查用户在uwp中的c#中选择的文件类型

[英]check which type of file selected by user in c# in uwp

User can select multiple types of files- .txt or .pdf Based on the selected file type different actions are taken. 用户可以选择多种类型的文件-.txt或.pdf根据所选的文件类型采取不同的操作。 How to check which type of file selected by the user in c# 如何在C#中检查用户选择的文件类型

If you have the path to the file you can check by using Path.GetExtension() and create a switch between supported types. 如果您具有文件的路径,则可以使用Path.GetExtension()进行检查,并在支持的类型之间创建一个开关。

See: MSDN Documentation 请参阅: MSDN文档

在UWP中,如果要获取用户选择的文件的扩展名,由于这是一个StorageFile ,您可以直接在Storage File上使用FileType

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM