Split() публичный статический Метод

public static Split ( string path ) : string[]
path string
Результат string[]
Пример #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]);
 }
Пример #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);
        }