Welcome to YT.
Nope, this type of fence isn't good for yorkies (or any breed). Besides the pain, there are otherrisks. Yrkies are so small and a target for stray dogs, very large birds, coyotes, etc. This does nothing to keep other animals out. Some dogs don't care about the shock either. They will run throughit and then be afraid to come back in the yard.
Because yorkies should always be supervised outside, a leash or even a tie out (under supervision) would be better.