vb.net - Is it correct to correct properties values on the fly? -


Is it correct to correct property values ​​on the fly?

For example: (note.)

  Get the string return as public property X () Set the _x.ToLower end (by typing string as Val Value) _x = value.ToLower End Set End Property  

Gates / There is nothing wrong with standardizing the properties. Without any context that represents X, it is difficult to determine whether a property is the right way to reach and update the value of X. Depending on the application, this is not a public setter, but instead there is a method. Customer's Resident Change (XUpdatedValue as String)

However, some improvements to your code:

  1. Make sure _x is private so modify other square value.
  2. Make ToLower only on the setter, not both. Unless you follow the next conference, that should work fine.
  3. Within this class _x should go all calls through X, thus the value of _x is correct.

Comments