Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
表达式是一个值,因此不能作为赋值的目标-asp.net_Asp.net - Fatal编程技术网

表达式是一个值,因此不能作为赋值的目标-asp.net

表达式是一个值,因此不能作为赋值的目标-asp.net,asp.net,Asp.net,我得到了上面的错误。它是在开发模式下工作,但不是在现场,有什么想法吗 读卡器中有适当的值,因为我已将它们写入文本文件 Do While reader.Read() personList.Add(New Person() With {.ID = reader("user_id"), .Name = reader("person")}) Loop 谢谢 Public Class Person Private m_ID As Integer P

我得到了上面的错误。它是在开发模式下工作,但不是在现场,有什么想法吗

读卡器中有适当的值,因为我已将它们写入文本文件

        Do While reader.Read()
            personList.Add(New Person() With {.ID = reader("user_id"), .Name = reader("person")})
        Loop
谢谢

Public Class Person
Private m_ID As Integer
Public Property ID() As Integer
    Get
        Return m_ID
    End Get
    Set(ByVal value As Integer)
        m_ID = value
    End Set
End Property
Private m_Name As String
Public Property Name() As String
    Get
        Return m_Name
    End Get
    Set(ByVal value As String)
        m_Name = value
    End Set
End Property

现在分类,只是用不同的方式。让新的构造函数获取参数并按这种方式设置。将它们作为可选的构造放在其他地方调用,不需要参数

Public Sub New(Optional ByVal uid As Integer = 0, Optional ByVal uname As String = "")
    ID = uid
    Name = uname
End Sub


Dim uid As Integer
Dim uname As String
Do While reader.Read()
   uid = reader("user_id")
   uname = reader("person")
   personList.Add(New Person(uid, uname))
Loop

我们能看看班上的人吗?至少是财产。