Vorrei definire una proprietà in modo che, laddove non le venga attribuito un valore dal programmatore, acquisisca un valore di default. Io avevo pensato di impostare la cosa in questa maniera:
In questo modo se scrivo MiaClasse.MyHashKey = "Pippo" la proprietà avrà valore "Pippo". Se invece non preciso nulla la proprietà avrà valore "User".codice:Public writeonly Property MyHashKey As String Set if value is nothing then _myhashkey = "User" else _myhashkey = value end if End Set End Property
Solo che evidentemente "is nothing" non è corretto perchè se do un valore alla proprietà tutto bene, ma se non do alcun valore la proprietà rimane nothing anzichè User.
Come posso fare?
Ciao e grazie