0

我有一个包含一个结构的类,该结构必须传递给属于不同类的另一个函数。(VB.NET)

Public Class A_one
         Private Structure Profile
            Dim strUIConfig as String
            Dim blah blah as String
            Dim Xyz as string
         End Structure

         Dim testProfile as New Profile()
         'inititialize testProfile Here

        toObj.send_profile(testProfile)

Public Class B_one
        send_profile(ByVal x as A_one.Profile)    ' How should I provide the declaration here ?
        'blah blah blah do stuff
        p = x.strUIconfig    '???

我觉得奇怪的是 A_one 类没有 dll,因此我可以将该 dll 作为参考添加到 B 类中 - 当我将 A_one 类的 dll 导入 B 类时,这将在技术上解决问题。我的理解正确吗?

4

1 回答 1

1

您已将其声明为Profile私有-A_one所以它甚至在B_one. 如果您将其公开,您将能够使用:

send_profile(ByVal as A_one.Profile)

通常会鼓励您避免创建非私有嵌套类型。它当然很有用,但也可能有点痛苦。

于 2012-09-12T23:03:55.557 回答