MS 파일 및 경로에 대한 몇 가지 메소드 레코드
4317 단어 서류
String path1 = System.IO.Directory.GetCurrentDirectory();
MessageBox.Show(" :" + path1);
// 。
String path2 = System.AppDomain.CurrentDomain.BaseDirectory;
MessageBox.Show(" :" + path2);
// 。
String path3 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
MessageBox.Show(" :" + path3);
// , 。
String path4 = System.Windows.Forms.Application.StartupPath;
MessageBox.Show(" , :" + path4);
//
String path5 = System.Windows.Forms.Application.ExecutablePath;
MessageBox.Show(" :" + path5);
2 폴더 아래의 모든 파일 이름 가져오기
2.1 DirectoryInfo 사용
using System.IO;//DirectoryInfo
using System.Windows.Forms; //Application
DirectoryInfo dzong = new DirectoryInfo(Application.StartupPath);
foreach (FileInfo fi in dzong.GetFiles())
{
if (fi.Extension.Equals(".doc"))
{
cbox.Items.Add(fi.Name.Replace(".doc", ""));//cbox combox
}
}
2.2 Directory 사용
using System.IO;//Directory
foreach (string f in Directory.GetFiles(Application.StartupPath , "*.doc"))
{
string[] str = f.Split('\\');
cb_SelectSkin.Items.Add((str[str.Count() - 1]).Replace(".doc", ""));//
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
SF:alesforce에서 파일을 업로드하는 수신 객체*document에 folderId를 지정해야 합니다. private Document document = new Document(); public Document getDocument(){ return documen...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.