首页 > 解决方案 > OrderedDictionary 的替代或解决方法以避免重复键错误

问题描述

我正在使用一个函数来返回 OrderedDictionary 并填充 pdf 的一部分,但我需要包含重复的键,因为它们是标签文本。有没有办法掩盖受骗者或更好的方法来做到这一点,而不是对受骗者挑剔?

    Private Shared Async Function GetSiteSpecificStaging(MDTID As String, Optional cSite As String = Nothing) As Task(Of OrderedDictionary(Of String, String))
            Using con = New SqlConnection(ConnectionString),
                com = con.CreateCommand
                com.CommandType = CommandType.StoredProcedure
                com.CommandText = "GetPrintStagingData"
                com.CommandTimeout = 600
                con.Open()
                com.Parameters.AddWithValue("@MDTID", MDTID)

                Using r = Await com.ExecuteReaderAsync().ConfigureAwait(False)
                    If r.Read Then
                        Return New OrderedDictionary(Of String, String) From {
                            {"Reported Date", r("StageReportDate1").ToString.NullIfNotDate?.ToShortDateString},
                            {"Reporting Organisation", r("StageReportOrg1").ToString},
                            {"Chang Stage", r("Chang").ToString},
                            {"INRG Staging System", r("INRG_DESC").ToString},
                            {"Biopsy Gleason", FormatGleason(r("BiopsyGleason1").ToString, r("BiopsyGleason2").ToString)},
                            {"Reported Date", r("StageReportDate2").ToString},
                            {"Reporting Organisation", r("StageReportOrg2").ToString}
                        }
                    Else
                        Return New OrderedDictionary(Of String, String)
                    End If
                End Using
            End Using
        End Function

标签: .netvb.netvisual-studiovisual-studio-2017

解决方案


推荐阅读