C# practice - What am I doing wrong?
I'm a total beginner in programming - doing it as a hobby. Started learning C#. I tried writing a very basic program that prints out my first name "Tom" in capital letters and my last name "Eckert" in small case letters. I managed to have it write my last name in small case but somehow it also writes my full name in capitals instead of only my first name, and I don't seem to understand what I'm doing wrong. Help would be appreciated! Here's my code: using System; namespace Review { class Program { static void Main(string[] args) { string myName = "Tom Eckert"; int firstNamePosition = myName.IndexOf("Tom"); int lastNamePosition = myName.IndexOf("Eckert"); string firstName = myName.Substring(firstNamePosition); string lastName = myName.Substring(lastNamePosition); string firstNameUpper = firstName.ToUpper(); string lastNameLower = lastName.ToLower(); Console.WriteLine(firstNameUpper + " " + lastNameLower); } } }