The following syntax converts a DataTable to a Dictionary .
in C#
Dictionary<string, string> dicCodes = ds.Tables[0].AsEnumerable()
.ToDictionary<DataRow, string, string>(
row => row.Field<string>("Column1Name"),
row => row.Field<string>("Column2Name")
);
in VB.NET
Dim dicCodes As Dictionary(Of String, String) =
ds.Tables(0).AsEnumerable() _
.ToDictionary(Of String, String)(
Function(row) row.Field(Of String)("Column1Name"),
Function(row) row.Field(Of String)("Column2Name")
)
be the happy Gosu.
woojja ))*
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
반응형
'.NET' 카테고리의 다른 글
[.NET] .NET MAUI 소개 - 하나의 Codebase, 다양한 Platforms (2) | 2022.05.27 |
---|---|
[.NET] .NET MAUI 를 소개합니다. (0) | 2021.11.26 |
[.NET] Time Zone Identifiers (2) | 2018.07.24 |
[.NET] Clone (0) | 2017.05.31 |
[.NET] Collection was modified; enumeration operation may not execute. (4) | 2017.05.30 |