Length of string

Given a string, write a method that returns its length. Do not use library methods!
Expected input and output
LengthOfAString("computer") → 8 LengthOfAString("ice cream") → 9
using System;

namespace CSharpExercises.Strings
{
    class LengthOfAStringTask
    {
        static int LengthOfAString(string str)
        {
            int length = 0;
            foreach (char c in str)
            {
                length++;
            }

            return length;
        }
    
        static void Main(string[] args)
        {
            Console.WriteLine(LengthOfAString("Lorem ipsum dolor sit amet")); //26
            Console.WriteLine(LengthOfAString(string.Empty));                 //0
            Console.WriteLine(LengthOfAString("conse12ctetur "));             //14
        }
    }
}