feat(csharp) .NET 8.0 code migration (#966)

* .net 8.0 migration

* update docs

* revert change

* revert change and update appendix docs

* remove static

* Update binary_search_insertion.cs

* Update binary_search_insertion.cs

* Update binary_search_edge.cs

* Update binary_search_insertion.cs

* Update binary_search_edge.cs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
hpstory
2023-11-26 23:18:44 +08:00
committed by GitHub
parent d960c99a1f
commit 56b20eff36
93 changed files with 539 additions and 487 deletions
@@ -7,11 +7,11 @@
namespace hello_algo.chapter_backtracking;
public class preorder_traversal_iii_compact {
static List<TreeNode> path;
static List<List<TreeNode>> res;
List<TreeNode> path = [];
List<List<TreeNode>> res = [];
/* 前序遍历:例题三 */
static void PreOrder(TreeNode root) {
void PreOrder(TreeNode? root) {
// 剪枝
if (root == null || root.val == 3) {
return;
@@ -30,13 +30,11 @@ public class preorder_traversal_iii_compact {
[Test]
public void Test() {
TreeNode root = TreeNode.ListToTree(new List<int?> { 1, 7, 3, 4, 5, 6, 7 });
TreeNode? root = TreeNode.ListToTree([1, 7, 3, 4, 5, 6, 7]);
Console.WriteLine("\n初始化二叉树");
PrintUtil.PrintTree(root);
// 前序遍历
path = new List<TreeNode>();
res = new List<List<TreeNode>>();
PreOrder(root);
Console.WriteLine("\n输出所有根节点到节点 7 的路径,路径中不包含值为 3 的节点");