Imports System.Reflection
Imports Microsoft.VisualBasic.Serialization.JSON
Namespace TaskHost
'''
''' Json value of the function parameter, and the type information is also included in this property.
'''
'''
''' 不推荐使用泛型作为参数值
'''
Public Class Argument
'''
'''
'''
'''
'''
''' 在这里设置这个属性的原因是为了可以直接调用函数来完成反序列化操作
'''
Public Property type As String
'''
''' Json string
'''
'''
Public Property value As String
Sub New()
End Sub
'''
''' Creates the function remote calls one of its parameter value.
'''
'''
Sub New(o As Object)
Dim type As Type = o.GetType
Me.type = type.FullName
Me.value = JsonContract.GetObjectJson(o, type)
End Sub
Public Overrides Function ToString() As String
Return $"[{type.Split("."c).Last}] " & value
End Function
Public Function GetValue() As Object
Dim type As Type = Type.GetType(Me.type, True, False)
Dim obj As Object = JsonContract.LoadObject(value, type)
Return obj
End Function
End Class
End Namespace