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 160 views
2 answers 258 views
2 answers 283 views
1 answer 230 views
3 answers 330 views
1 answer 98 views
98 views asked Aug 7, 2023 by avibootz
1 answer 397 views
...