每当浏览c#中的文件时访问文件属性 [英] access file proprties whenever browse the files in c#

查看:72
本文介绍了每当浏览c#中的文件时访问文件属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实我在浏览文件的时候开发了winform应用程序,我想要文件属性



像文件名,文件路径,大小,扩展名,文件内容我的代码如:



Actually i have develop winform app for browse files at the time i want file propeties

like filename,path of file,size,extension,content of file my code like as:

private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.CheckFileExists = true;
            openFileDialog.AddExtension = true;
            openFileDialog.Multiselect = true;
            openFileDialog.Filter = "*.pdf";
            DialogResult result = openFileDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                string[] files = openFileDialog.FileNames;
            }
           
            
        }





请帮助我在浏览时访问文件属性文件



,如果你不能以这种方式访问​​文件属性,那就有一件事了。然后



将字符串数组转换为fileinfo数组。 fileinfo数组对访问文件很有用



属性这就是为什么我问ask.pls帮帮我。



pls help me for accessing file properties whenever browse the files

and one thing is if u not possible to access the file properties in this way. then

convert string array to fileinfo array. fileinfo array useful for access file

properties thats why i am asking.pls help me.

推荐答案

使用文件类检查它

你可以随意使用文件并轻松访问文件属性



https://msdn.microsoft.com/en-us/library/system。 io.file%28v = vs.110%29.aspx [ ^ ]
Use File Class Check it OUT
you can do what ever you want with file and easily access File Attributes

https://msdn.microsoft.com/en-us/library/system.io.file%28v=vs.110%29.aspx[^]


这篇关于每当浏览c#中的文件时访问文件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆