To find the position(s) of a character in a string in C#

The position(s) of a character in a string can be found out by the following example.

Steps:
1. We convert the string into char array.
2. We navigate through each character in the array.
3. We match each character with our search character.
4. We print the positions.

Example:

If the user wants the positions of character 'e' in the string "My name is Forget Code"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace ForgetCode
{
    class Program
    {
       static void Main(string[] args)
        {
            string text = "My name is Forget Code";
            char[] textarray = text.ToCharArray();

            for (int i = 1; i < text.Length; i++)
            {
             if (textarray[i].Equals('e'))
             {
             Console.WriteLine("The letter is present in " + (i+1) + "th position");
             }
                
            }
           
        }
    }
}


Output:
The letter is present in 7th position
The letter is present in 16th position
The letter is present in 22th position

If the user wants only the first occurrence of the character, then break statement can be supplied as below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace ForgetCode
{
    class Program
    {
       static void Main(string[] args)
        {
            string text = "My name is Forget Code";
            char[] textarray = text.ToCharArray();

            for (int i = 1; i < text.Length; i++)
            {
             if (textarray[i].Equals('e'))
             {
             Console.WriteLine("The letter is present in " + (i+1) + "th position");
             break;
             }
                
            }
           
        }
    }
}


Output:
The letter is present in 7th position