OrderedDictionary的替代方法或替代方法,以避免重复的键错误

时间:2020-04-17 13:33:48

标签: .net vb.net visual-studio visual-studio-2017

我正在使用一个函数返回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

0 个答案:

没有答案