Converting from String to Enum

I want to convert from String to Enum, but I am getting error…
I looked here Converting a string to an enum and used the same syntax C#,

selectedPetName = System.Enum.Parse (typeof(PetName), someText);

Here selectedPetName if of type PetName,
and the error that I’m getting is

  • error CS0266: Cannot implicitly convert type object' to GameManager.PetName’. An explicit conversion exists (are you missing a cast?)

I also tried to putting as PetName but error remains.

Since Enum.Parse returns an Object it should be

selectedPetName = (PetName) System.Enum.Parse (typeof(PetName), someText);