添加Lesson11
This commit is contained in:
@@ -45,6 +45,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson10_LinkedList", "Less
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson10_LinkedList练习", "Lesson10_LinkedList练习\Lesson10_LinkedList练习.csproj", "{547A4860-2E6F-4022-802A-F34204F7ADF5}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson10_LinkedList练习", "Lesson10_LinkedList练习\Lesson10_LinkedList练习.csproj", "{547A4860-2E6F-4022-802A-F34204F7ADF5}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson11_泛型栈和队列", "Lesson11_泛型栈和队列\Lesson11_泛型栈和队列.csproj", "{4CA252D3-7F2F-4204-85B5-178BC4227697}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson11_泛型栈和队列练习", "Lesson11_泛型栈和队列练习\Lesson11_泛型栈和队列练习.csproj", "{C91DDD1F-E702-430F-95FA-22BBEDE5E011}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -135,6 +139,14 @@ Global
|
|||||||
{547A4860-2E6F-4022-802A-F34204F7ADF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{547A4860-2E6F-4022-802A-F34204F7ADF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{547A4860-2E6F-4022-802A-F34204F7ADF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{547A4860-2E6F-4022-802A-F34204F7ADF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{547A4860-2E6F-4022-802A-F34204F7ADF5}.Release|Any CPU.Build.0 = Release|Any CPU
|
{547A4860-2E6F-4022-802A-F34204F7ADF5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4CA252D3-7F2F-4204-85B5-178BC4227697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4CA252D3-7F2F-4204-85B5-178BC4227697}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4CA252D3-7F2F-4204-85B5-178BC4227697}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4CA252D3-7F2F-4204-85B5-178BC4227697}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C91DDD1F-E702-430F-95FA-22BBEDE5E011}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C91DDD1F-E702-430F-95FA-22BBEDE5E011}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C91DDD1F-E702-430F-95FA-22BBEDE5E011}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C91DDD1F-E702-430F-95FA-22BBEDE5E011}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
namespace Lesson11_泛型栈和队列
|
||||||
|
{
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
#region 知识点一 回顾数据容器
|
||||||
|
#region 变量
|
||||||
|
//无符号
|
||||||
|
//byte ushort uint ulong
|
||||||
|
//有符号
|
||||||
|
//sbyte short int long
|
||||||
|
//浮点数
|
||||||
|
//float double decimal
|
||||||
|
//特殊
|
||||||
|
//char bool string
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 复杂数据容器
|
||||||
|
///枚举 enum
|
||||||
|
///结构体 struct
|
||||||
|
///数组(一维、二维、交错)[] [,] [][]
|
||||||
|
///类
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 数据集合
|
||||||
|
//using System.Collections;
|
||||||
|
|
||||||
|
//ArrayList object数据列表
|
||||||
|
//Stack 栈 先进后出
|
||||||
|
//Queue 队列 先进先出
|
||||||
|
//Hashtable 哈希表 键值对
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 泛型数据集合
|
||||||
|
//using System.Collections.Generic;
|
||||||
|
|
||||||
|
//List 列表 泛型队列
|
||||||
|
//Dictionary 字典 泛型哈希表
|
||||||
|
//LinkedList 双向链表
|
||||||
|
//Stack 泛型栈
|
||||||
|
//Queue 泛型队列
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 知识点二 泛型栈和队列
|
||||||
|
//命名空间 System.Collections.Generic
|
||||||
|
//在使用上和Stack和Queue类似
|
||||||
|
Stack<int> stack = new Stack<int>();
|
||||||
|
Queue<int> queue = new Queue<int>();
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
namespace Lesson11_泛型栈和队列练习
|
||||||
|
{
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
#region
|
||||||
|
//总结一下
|
||||||
|
//数组,List,Dictionary,Stack,Queue,LinkedList
|
||||||
|
//这些存储容器对我们来说应该如何使用
|
||||||
|
|
||||||
|
//普通线性表:
|
||||||
|
//数组,List,LinkedList
|
||||||
|
//数组:定长,查询快,增删慢
|
||||||
|
//List:经常增删,通过下标查询
|
||||||
|
//LinkedList:不定长的,经常增删,查找不多
|
||||||
|
|
||||||
|
//先进后出:
|
||||||
|
//stack
|
||||||
|
//对于一些可以利用先进后出逻辑的场景,可以使用stack
|
||||||
|
//例如游戏UI的打开和关闭
|
||||||
|
|
||||||
|
//先进先出:
|
||||||
|
//queue
|
||||||
|
//对于一些可以利用先进先出逻辑的场景,可以使用queue
|
||||||
|
//例如游戏中的子弹池,子弹的发射和回收
|
||||||
|
//消息队列
|
||||||
|
|
||||||
|
//键值对:
|
||||||
|
//Dictionary
|
||||||
|
//需要频繁通过键来查找值的场景,可以使用Dictionary
|
||||||
|
//比如ID对应的数据内容
|
||||||
|
//道具ID对应道具信息
|
||||||
|
//怪物ID对应怪物对象
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user