Split() public static method

public static Split ( string path ) : string[]
path string
return string[]
Exemplo n.º 1
0
 public static string GetFileOrFolderName(string path)
 {
     if (File.Exists(path))
     {
         return(Path.GetFileName(path));
     }
     if (!Directory.Exists(path))
     {
         throw new ArgumentException("Target '" + path + "' does not exist.");
     }
     string[] strArray = Paths.Split(path);
     return(strArray[strArray.Length - 1]);
 }
Exemplo n.º 2
0
        public static string GetFileOrFolderName(string path)
        {
            string result;

            if (File.Exists(path))
            {
                result = Path.GetFileName(path);
            }
            else
            {
                if (!Directory.Exists(path))
                {
                    throw new ArgumentException("Target '" + path + "' does not exist.");
                }
                string[] array = Paths.Split(path);
                result = array[array.Length - 1];
            }
            return(result);
        }