Searching a string inside a string in C#

We can search and get the position of a string inside another string using IndexOf()

using System;
using System.IO;
using System.Text;

namespace forgetCode
{
    class program1
    {
        static void Main(string[] args)
        {
            string baseString = "Forget code";

            string subString = "get";

            int iWhere = baseString.IndexOf(subString);

            Console.WriteLine("Occurred at : " + iWhere +" position");

        }
   
    }
}


Output:
Occurred at : 3 position

..