diff --git "a/\346\261\237\346\226\207\346\267\257/20241209.md" "b/\346\261\237\346\226\207\346\267\257/20241209.md" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\346\261\237\346\226\207\346\267\257/20241212.md" "b/\346\261\237\346\226\207\346\267\257/20241212.md" new file mode 100644 index 0000000000000000000000000000000000000000..c80f59dfc8bbf7ed51e5d3c39861b84fdf0a0ee1 --- /dev/null +++ "b/\346\261\237\346\226\207\346\267\257/20241212.md" @@ -0,0 +1,17 @@ +## Linq查询作业 +基础练习 +```cs + public IActionResult One() + { + int[] numbers = { 1, 2, 3, 4, 5, 6 }; + //1.查询特定元素 找出数组中等于5的元素 + var a = numbers.Where(x => x == 5); + //2.查询特定范围的元素 找出数组中在2到8之间的元素 + var b = numbers.Where(x => x >= 2 && x <= 8); + + ViewBag.a = string.Join("",b); + //3.查询并转换元素 将数组中的每个数字乘以2 + var c=numbers.Select(x=>x*2); + return View(); + } +``` \ No newline at end of file