When you fix the following rule:
Do not declare externally visible instance fieldsViolation DescriptionExternally visible type BuildLab.SharedFunctionality.Utility.ActiveDirectoryWrapper contains an instance field userData is externally visible because has public modifier. Correcting ViolationThe rule provides the following auto-correct options: - Change field modifier to private.
- Create property from the field and set its modifier to public.
- Create property from the field with name and modifier specified.
|
you currently rename the public property to be userData1 by default. I personally can't stand numbers being tagged on to things, but that is a minor problem If the field was used globally, there is a very good chance that the name is what they want it to be referred to. It would make much more sense to me to simply rename the filed to a different name and keep the property as the same name. Then your code won't get littered with old field names with 1 tagged at the end. Now the private field is being renamed, it can have a more sensible name like UserDataInternal, or MyUserData, or anything that is more descriptive than UserData1! So in this example: public string userData1; becomes: private string userDataInternal; public string { get { return userDataInternal; } set { userDataInternal = value; } } The options page should allow you to override both the public and the private default names, but ideally you need a useable default. Thanks, Chris. |