Using CObj in Attribute Arguments
Previous versions of Visual Basic did not allow use of the CObj
conversion function in attribute arguments. Visual Basic 2015 fixes this issue. For instance, suppose you extend the DocumentPropertiesAttribute
class with the following Metadata
property of type Object
and accept an argument of the same type in the constructor:
Protected _metaData As ObjectPublic Overridable Property Metadata As Object Get Return Me._metaData End Get Set(value As Object) Me._metaData = value End SetEnd PropertyPublic Sub New(author As String, reviewer As String, metaData As Object) Me._author = author Me._reviewer = reviewer Me._LastEdit = CStr(Date.Today) Me._metaData ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.