全て
| カテゴリ未分類
| 通常
| 数学
| 投資
| 副業
| 転職・就職
| ブログ
| 株Stock
| VBA
| SharePoint
| REST API
| RenderListDataAsStream
| PowerAutomateDesktop
| Graph API
| PowerApps
| PowerAutomate
| PowerFx
| OfficeScriptオフィススクリプト
| PowerAutomate日時Excel日時相互関係
| PowerShell
| Dataverse
| UiPath
| OneDrive
| LINQ
| VB.NET
| C#.NET
| WPFC#.NET
| Git
カテゴリ:LINQ
using System; using System.Data; using System.Linq; class Program { static void Main() { // サンプルのDataTableを作成する DataTable table = new DataTable(); table.Columns.Add("列1", typeof(string)); table.Columns.Add("列2", typeof(string)); table.Columns.Add("列3", typeof(int)); // ダミーデータを挿入する table.Rows.Add("XXX", "データ1", 10); table.Rows.Add("YYY", "データ2", 20); table.Rows.Add("XXX", "データ3", 30); table.Rows.Add("ZZZ", "データ4", 40); // 列1の値が 'XXX' のデータを取得する var result = from row in table.AsEnumerable() where row.Field<string>("列1") == "XXX" select row; // 結果を表示する foreach (var row in result) { Console.WriteLine($"列1: {row.Field<string>("列1")}, 列2: {row.Field<string>("列2")}, 列3: {row.Field<int>("列3")}"); } } } お気に入りの記事を「いいね!」で応援しよう
Last updated
2024.02.27 04:44:33
[LINQ] カテゴリの最新記事
|