解决方法
If the key parameter is an empty string (“”),a string that consists of a single underscore character (_) is returned. If the key parameter is not an empty string,the VerifyResourceName method compares each character in the string to a set of invalid tokens based on the language specified by the provider parameter. Any invalid character in the string is replaced with an underscore character. The characters that will be replaced with an underscore are as follows:
‘ ‘ (space),U+00A0 (non-breaking space),‘.’ (period),‘,’ (comma),‘;’ (semicolon),‘|’,‘~’,‘@’,‘#’,‘%’,‘^’,‘&’,‘*’,‘+’,‘-‘,‘/’,‘\’,‘<‘,‘>’,‘?’,‘[‘,‘]’,‘(‘,‘)’,‘{‘,‘}’,‘”‘ (quote),”’ (apostrophe),‘:’,and ‘!’.
Note
Strongly-typed resources do not allow the use of language keywords (such as if,for,and so on) as resource key names. However,the System.CodeDom design pattern allows the use of language keywords by prefixing the keyword with the underscore character. The VerifyResourceName method calls the CreateValidIdentifier method to enforce this design. For example,if you use a resource name that is the same as a language keyword,such as for,the name appears as _for in the generated strongly-typed resource class.
查看StronglyTypedResourceBuilder类的源代码,文档准确无误.