即時通訊新手到c#.net,任何一個讓我知道如何獲取文件大小,文件名,在C#Windows文件分機。如何在C#Windows中獲取文件大小,文件名,文件擴展名?
IM使用C#的打開文件對話框..即時通訊只獲得了path..i不知道如何獲取文件名和大小..
我的代碼是:
openFileDialog1.ShowDialog();
openFileDialog1.Title = "Select The File";
openFileDialog1.InitialDirectory = "C:";
openFileDialog1.Multiselect = false;
openFileDialog1.CheckFileExists = false;
if (openFileDialog1.FileName != "")
{
txtfilepath1.Text = openFileDialog1.FileName;
var fileInfo = new FileInfo(openFileDialog1.FileName);
lblfilesize1.Text = Convert.ToString(openFileDialog1.FileName.Length);
lblfilesize=
lblfilename=
}