How to get filename from path without extension in C#

1 Answer

0 votes
using System;
using System.IO;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = "d:\\c-sharp cource\\C_Sharp.htm";

            string filename = Path.GetFileNameWithoutExtension(path);

            Console.WriteLine(filename);
        }
    }
}


/*
run:

C_Sharp


*/

 



answered Mar 9, 2017 by avibootz

Related questions

1 answer 181 views
2 answers 273 views
2 answers 310 views
1 answer 249 views
3 answers 351 views
1 answer 109 views
109 views asked Aug 7, 2023 by avibootz
1 answer 408 views
...