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
+3 -3
View File
@@ -9,11 +9,11 @@ namespace hello_algo.chapter_heap;
/* 大顶堆 */
class MaxHeap {
// 使用列表而非数组,这样无须考虑扩容问题
private readonly List<int> maxHeap;
List<int> maxHeap;
/* 构造函数,建立空堆 */
public MaxHeap() {
maxHeap = new List<int>();
maxHeap = [];
}
/* 构造函数,根据输入列表建堆 */
@@ -130,7 +130,7 @@ public class my_heap {
[Test]
public void Test() {
/* 初始化大顶堆 */
MaxHeap maxHeap = new(new int[] { 9, 8, 6, 6, 7, 5, 2, 1, 4, 3, 6, 2 });
MaxHeap maxHeap = new([9, 8, 6, 6, 7, 5, 2, 1, 4, 3, 6, 2]);
Console.WriteLine("\n输入列表并建堆后");
maxHeap.Print();