Get File Paths - CSharp System.IO

CSharp examples for System.IO:File Path

Description

Get File Paths

Demo Code


using System.IO;/*  ww  w . j a  va 2 s. com*/
using System.Linq;
using System.Collections.Generic;

public class Main{
        public static List<string> GetFilePaths(string path)
        {
            //  GetFullPath returns the absolute path for the folder.
            //  Xaml will not work with relative paths as an image source.
            string[] filenames = Directory.GetFiles(Path.GetFullPath(path));
            if (filenames == null) return new List<string>();
            return filenames.ToList<string>();
        }
}

Related Tutorials