NewIfNull
Shortcut to create an object if it's null
Source
<Extension>
Public Function NewIfNull(Of T As Class)(ByRef value As T) As T
If value Is Nothing Then
value = GetType(T).CreateInstance
Return value
Else
Return value
End If
End Function
Example
Private _person As Person
Public ReadOnly Property Person As Person
Get
Return _person.NewIfNull
End Get
End Property