SenseNet.ContentRepository.Storage.RepositoryPath.GetFileName C# (CSharp) Метод

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

Gets the file name from a valid path, which is located after the last PathSeparator.
public static GetFileName ( string path ) : string
path string The path.
Результат string
		public static string GetFileName(string path)
		{
			if (path == null)
				throw new ArgumentNullException("path");
            int p = path.LastIndexOf(PathSeparator, StringComparison.Ordinal);
			if (p < 0)
				return path;
			return path.Substring(p + 1);
		}
        //TODO: Missing unit test

Usage Example

Пример #1
0
 private BinaryFileName NormalizeFileName(BinaryFileName fileName)
 {
     if (fileName.FullFileName.Contains("\\"))
     {
         return(Path.GetFileName(fileName.FullFileName));
     }
     if (fileName.FullFileName.Contains("/"))
     {
         return(RepositoryPath.GetFileName(fileName.FullFileName));
     }
     return(fileName);
 }