Merge pull request #2388 from Chenxue3/master

Update 链表理论基础.md 添加C#版本
This commit is contained in:
程序员Carl
2024-01-02 09:27:50 +08:00
committed by GitHub

View File

@ -250,9 +250,32 @@ typedef struct ListNodeT {
} ListNode;
```
### C#
```c#
public class Node<T>
{
// 节点存储的数据
public T Data { get; set; }
// 指向下一个节点的引用
public Node<T> Next { get; set; }
// 节点的构造函数,用于初始化节点
public Node(T data)
{
Data = data;
Next = null; // 初始时没有下一个节点,因此设为 null
}
}
```
<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>