Why didn't ToUpper do anything?

It did. You threw the answer away.

Why didn't ToUpper do anything?

The problem

The result goes nowhere.

string name = "  player one "; name.Trim();name.ToUpper(); Show( name );   // "  player one "

Strings never change. Trim and ToUpper hand back a new string, and nothing kept it.

Why it happens

Strings are read only.

Every string method that seems to edit one builds a new string instead.

Trim, ToUpper
return a new string
Replace, Substring
return a new string
The original
never changes

The fix in code

Keep what comes back.

string name = "  player one "; name = name.Trim().ToUpper(); Show( name );   // "PLAYER ONE"

Assign the result. Chaining works because each call returns the next string.

Same trap

LINQ doesn't sort your list.

enemies.OrderBy( e => e.Distance );   // does nothing enemies = enemies.OrderBy( e => e.Distance ).ToList();

OrderBy hands back a new sequence. The list itself is untouched.

The rule

Strings don't change. Keep the new one.

Wrong
name.Trim();
Right
name = name.Trim();
Same with
Replace, ToUpper, OrderBy