0

clsFile 有 2 个字典,但是,在构造函数中,第一个字典总是创建,但第二个字典最终是 Nothing

字典相同(Of Long,clsEmployee);但之前我尝试制作第二个(Long,clsCondition)和(Of String,clsCondoition) - 无济于事。类 clsEmployee 和 clsCondition 也是代码中的对象。

clsFile 的代码:

Option Explicit On
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Text.RegularExpressions


Public Class clsFile


'-- CLASS LOCAL VARIABLES DECLARATION
Private cnDB As SqlConnection
Private m_Number As String
Private m_Auditor As clsEmployee
Private m_User As clsEmployee
Private m_Reviewer As clsEmployee
Private m_FileTypeId As Long
Private m_ReviewStatusId As Long
Private m_ActionDTTM As Date
Private m_SelectDTTM As Date
Private m_ReviewDTTM As Date

Private m_inAudit As Boolean
Private m_ReviewersDict As Dictionary(Of Long, clsEmployee)
Private m_ConditionsDict As Dictionary(Of Long, clsEmployee)


**************************************PROPERTIES***********************************

  Public Property Reviewers() As Dictionary(Of Long, clsEmployee)
    Get
        Reviewers = m_ReviewersDict

    End Get

    Set(ByVal ReviewersDict As Dictionary(Of Long, clsEmployee))
        m_ReviewersDict = ReviewersDict
    End Set
End Property

Public Property Conditions() As Dictionary(Of Long, clsEmployee)
    Get
        Conditions = m_ConditionsDict

    End Get

    Set(ByVal ConditionsDict As Dictionary(Of Long, clsEmployee))
        m_ConditionsDict = Conditions
    End Set
End Property

* ** * ** * ** * ** * *构造函数* ** * ** * ** * ** * ** * ** *

 Public Sub New(*arguments provided*)
    number= strLoanNumber

    Me.Reviewer = New clsEmployee(RVWR_ID)
    Me.Reviewer.Dept.Id = RBW_Dept_ID
    Me.Auditor = New clsEmployee(AUD_ID)
    Me.User = New clsEmployee(USR_ID)

    Me.Reviewers = New Dictionary(Of Long, clsEmployee)
    Me.Conditions = New Dictionary(Of Long, clsEmployee) 

    cnDB = SQLcn


End Sub

` 单步执行代码时 - Me.Conditions = 即使在构造函数运行后也没有。我使用 VB.net,VS2005。

任何想法为什么?谢谢!

4

1 回答 1

2

一定

Set(ByVal ConditionsDict As Dictionary(Of Long, clsEmployee))
        m_ConditionsDict = Conditions
End Set

应该

Set(ByVal ConditionsDict As Dictionary(Of Long, clsEmployee))
        m_ConditionsDict = ConditionsDict
End Set

?

于 2013-01-23T20:54:19.050 回答