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 268 views
2 answers 403 views
2 answers 450 views
1 answer 347 views
3 answers 521 views
1 answer 175 views
175 views asked Aug 7, 2023 by avibootz
1 answer 510 views
...