Vivek Shukla
Vivek Shukla

Reputation: 733

List of resource names which shouldn't be used to Avoid not a valid Identifier warning

I gave a try to find a consolidated list of identifiers which one shouldn't use while creating resource names, but couldn't find one.

Please provide a list of identifiers which one should not use.

I learned that Visual Studio throws warning for identifiers like hyphens(-), dot(.), but as I mentioned I do not have a full list.

Upvotes: 1

Views: 403

Answers (1)

Georg Patscheider
Georg Patscheider

Reputation: 9463

If you look at the generated Resource.Designer.cs, you will see that the resource key is used as property name.

For example the Key "AddUser" is implemented like this:

/// <summary>
///   Looks up a localized string similar to Add User.
/// </summary>
public static string AddUser {
    get {
        return ResourceManager.GetString("AddUser", resourceCulture);
    }
 }

Therefore, the resource key must adhere to the C# spec for Identifiers.

(Compare with the spec for Properties: [attributes] [modifiers] type identifier {accessor-declaration})

Upvotes: 2

Related Questions