![]() To avoid those problems you write unit tests for properties – just to make sure your properties are handling their internal variables correctly. Specially if internal variables have similiar names. As people are error prone then it is easy to make mistakes in classic properties. SSN is classic property and it is up to programmer to handle value of the property correctly. Of course, compilator generates default constructor if you don’t write one but what you win is shorter code. You don’t have to write constructor to class just to initialize properties that have simple value types. If you are interested in internals of automatic properties then you may read my blog posting Is Automatic Property Same as Property? Property initializationĪs you can see from class above you can assign initial values to automatic properties. They are automatic because after compiling they look almost like SSN property – the variable that holds property value is created automatically. FirstName and LastName are automatic properties. There are three properties: FirstName, LastName and SSN. ![]() Public Property FirstName As String = "John" ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |