EndsWith() in C#

You can check for a string ends with a particular string or not like below:

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            string name1 = "code";
            
            bool b = name1.EndsWith("de");

            Console.WriteLine(b);
                        
        }

    }
}


Output:
True

..

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            string name1 = "code";
            
            bool b = name1.EndsWith("def");

            Console.WriteLine(b);
                        
        }

    }
}


Output:
False

..