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
@@ -8,7 +8,7 @@ namespace hello_algo.chapter_searching;
public class linear_search {
/* 线性查找(数组) */
static int LinearSearchArray(int[] nums, int target) {
int LinearSearchArray(int[] nums, int target) {
// 遍历数组
for (int i = 0; i < nums.Length; i++) {
// 找到目标元素,返回其索引
@@ -20,7 +20,7 @@ public class linear_search {
}
/* 线性查找(链表) */
static ListNode? LinearSearchLinkedList(ListNode? head, int target) {
ListNode? LinearSearchLinkedList(ListNode? head, int target) {
// 遍历链表
while (head != null) {
// 找到目标节点,返回之
@@ -37,7 +37,7 @@ public class linear_search {
int target = 3;
/* 在数组中执行线性查找 */
int[] nums = { 1, 5, 3, 2, 4, 7, 5, 9, 10, 8 };
int[] nums = [1, 5, 3, 2, 4, 7, 5, 9, 10, 8];
int index = LinearSearchArray(nums, target);
Console.WriteLine("目标元素 3 的索引 = " + index);