在下面的方法中,我试图将一个动态成员添加到一个expando对象,但它会抛出一个异常:
找不到展开对象的公共成员
Private Sub GetAckValues()
Try
Dim ack_duration As String = String.Empty
Dim ack_by_user_fkid As String = String.Empty
Dim ack_time As String = String.Empty
ack_duration = txtdefaultack.Text
ack_by_user_fkid = Convert.ToString(Session("user_code"))
Dim Ack_Detail As Object = New ExpandoObject()
Ack_Detail.ack_duration = ack_duration
Ack_Detail.ack_by_user_fkid = ack_by_user_fkid
receiptObject.StatusObject = Ack_Detail
Catch ex As Exception
logger.Error("Enter JobRequest form done by :" & LoggedinUserId, ex)
End Try
End Sub
答案 0 :(得分:1)
应该这样:
Ack_Detail.ack_duration = Ack_Detail.ack_duration
实际上就是这样:
Ack_Detail.ack_duration = ack_duration