Never heard of this "magic string" concept. I understand it, but I don't understand how 'Keyboard.DOT' protects against it.
Magic strings are when you use string or numbers ( magic numbers) that by themselves have no meaning, and u have to have contextual knowledge to know what it means. For example
Imagine the following code
If any one has to read that the first thing they will ask, is what the F is 1.
Now read this
Everyone can read that the code is executed when the claim type is insurance. It is much more human readable, and you need less contextual knowledge.
Also imagine the following snippet.
All those "1" have different context values, in one is a business logic descriptor, in other is a very dark color, in another is an error code, etc. Now imagine the requirement been changed to, On insurance claims, after applying the premmium, add a fee.
If you do a text search, for "claimType == 1, then is going to miss where is written as "claimType== 1" "or claimType==1", If you do a search for "1" the it will return one million results. Now the best search is Find usage of EnumType.Insurance, that will give you the most refined results posible, and you can see all the places where is been used, and then u make your change there as needed.