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 168 views
2 answers 268 views
2 answers 297 views
1 answer 240 views
3 answers 343 views
1 answer 104 views
104 views asked Aug 7, 2023 by avibootz
1 answer 403 views
...