C# 静态与动态数组

C#中的数组是由System.Array类衍生出来的引用对象,因此可以使用Array类中的各种方法对数组进行各种操作。

System.Array类是在C#中用于处理数组的基类。它是所有数组类型的基类,包括静态数组和动态数组(例如List<T>)。System.Array提供了许多有用的方法和属性,用于操作和管理数组。

以下是一些常用的System.Array类成员:

  • Length属性:获取数组的总元素数。
  • Rank属性:获取数组的维度数。
  • GetLength(int dimension)方法:获取指定维度的元素数。
  • GetLowerBound(int dimension)方法:获取指定维度的最小索引值。
  • GetUpperBound(int dimension)方法:获取指定维度的最大索引值。
  • GetValue(params int[] indices)方法:获取指定索引处的数组元素的值。
  • SetValue(object value, params int[] indices)方法:设置指定索引处的数组元素的值。
  • Clone()方法:创建当前数组的浅表副本。
  • CopyTo(Array array, int index)方法:将当前数组的元素复制到另一个数组中。
  • IndexOf(object value)方法:在数组中搜索指定的元素,并返回其第一个匹配项的索引。
  • Sort()方法:对数组的元素进行排序。

通过使用System.Array类的这些成员,可以轻松地执行各种操作,例如获取数组的大小、访问特定元素、复制数组、搜索元素以及对数组进行排序等。

数组可以是静态数组或动态数组(也称为列表)。让我们更详细地了解它们吧。

静态数组: 静态数组是在编译时定义并具有固定长度的数组。它们使用固定的内存块来存储数据,并且在创建后大小不能更改。声明静态数组时,需要指定元素的类型和数组的大小。

静态数组在创建后无法动态调整大小,如果需要添加或删除元素,就需要创建一个新的数组,并将旧数组的值复制到新数组中。

动态数组(列表): 动态数组是在运行时创建并可以根据需要调整大小的数组。在C#中,System.Collections.Generic命名空间提供了List<T>类,它是一个动态数组的实现。与静态数组不同,动态数组可以动态地添加、删除和调整大小,无需创建新的数组。

动态数组(列表)相对于静态数组具有更多的灵活性和便利性,因为它们可以根据需要动态调整大小,并且提供了一组方便的方法来操作数组元素。然而,静态数组在某些情况下可能更加高效,因为它们在内存上是连续的,并且不需要额外的引用对象。因此,在选择使用静态数组还是动态数组时,需要根据具体需求和性能考虑做出决策。

一维数组

这段代码演示了如何在C#中定义和初始化一维数组。

  1. 定义和初始化整数数组:通过使用new关键字创建一个包含10个元素的整数数组IntArray,并使用花括号{ }初始化数组的元素。数组中的元素依次为1、2、3、4、5、6、7、8、9和10。

  2. 定义和初始化字符串数组:同样地,使用new关键字创建一个包含3个元素的字符串数组StrArray,并使用索引方式为数组元素赋值。在示例中,给StrArray[0]StrArray[1]赋值为字符串"abc"。

这些示例展示了如何定义和初始化一维数组,并在创建数组时指定初始元素的值。一维数组在C#中是最简单的数据结构之一,用于存储和处理多个相同类型的元素。

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 定义一维数组
            int[] IntArray = new int[10] {1,2,3,4,5,6,7,8,9,10};

            // 定义一维字符串数组
            string[] StrArray = new string[3];

            StrArray[0] = "abc" ;
            StrArray[1] = "abc";

            Console.ReadKey();
        }
    }
}

删除一维数组中的元素

这段代码演示了如何遍历和删除一维数组中的元素。

  1. 遍历数组:使用foreach循环遍历整数数组IntArray中的每个元素,并将其打印到控制台上。通过foreach循环可以方便地遍历数组中的所有元素。

  2. 删除数组元素:通过循环删除第三个元素。在示例中,我们将变量Del_Num设置为2,表示要删除的元素的索引位置。使用for循环从Del_Num开始,将后面的元素依次向前移动一个位置,以覆盖要删除的元素。最后,数组的最后一个元素将会是重复的元素,可以将其忽略或修改为其他值。

请注意,删除数组元素可能会导致数组长度减少,因此需要相应地调整循环的范围。在示例中,我们使用IntArray.Length - Del_Num作为循环的结束条件,以确保只处理剩余的有效元素。

这些示例展示了如何遍历数组和删除数组中的元素。一维数组是一种常见的数据结构,在C#中提供了丰富的操作和功能来处理和操作数组。

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 定义一维数组
            int[] IntArray = new int[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

            // 遍历数组
            foreach (int num in IntArray)
                Console.WriteLine(num);
            Console.ReadLine();

            // 通过循环删除第三个元素
            int Del_Num = 2;
            for (int x = Del_Num; x < IntArray.Length - Del_Num; x++)
            {
                IntArray[x] = IntArray[x - 1];
            }
            Console.ReadKey();
        }
    }
}

寻找最大最小值

这段代码演示了如何在一维数组中找到最大值、最小值、总和和平均值。

  1. 定义一维数组:使用int[] Array定义一个包含10个整数的一维数组,并为数组元素赋予初始值。

  2. 声明变量:声明变量minmax,并将其分别初始化为int.MaxValueint.MinValue。这样做是为了确保初始值为数组中的最大值和最小值。

  3. 遍历数组:使用for循环遍历数组中的每个元素。在循环中,比较每个元素与maxmin的值,更新它们的值以确保它们存储了数组中的最大值和最小值。

  4. 计算总和:使用变量sum初始化为0,并在循环中将每个元素累加到sum中,得到数组的总和。

  5. 计算平均值:通过将总和除以数组的长度,得到数组的平均值。

  6. 打印结果:使用Console.WriteLine打印最大值、最小值、总和和平均值。

该代码展示了如何通过遍历一维数组来查找最大值、最小值、总和和平均值。这些操作是处理数组数据时常见的需求。

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 定义一维数组
            int[] Array = new int[10] { 57, 32, 78, 96, 33, 11, 78, 3, 78, 2 };

            // 声明两个变量用来存储最大值和最小值
            int min = int.MaxValue;
            int max = int.MinValue;
            int sum = 0;

            for (int i = 0; i < Array.Length; i++)
            {
                if (Array[i] > max)
                    max = Array[i];

                if (Array[i] < min)
                    min = Array[i];

                sum += Array[i];
            }
            Console.WriteLine("最大值: {0} 最小值: {1} 总和: {2} 平均值: {3}", max, min, sum, sum / Array.Length);
            Console.ReadKey();
        }
    }
}

数组组合为字符串

这段代码演示了如何将字符串数组中的元素以竖线(|)连接起来。

  1. 定义字符串数组:使用String[] name定义一个包含多个姓名的字符串数组,并为数组元素赋予初始值。

  2. 声明变量:声明字符串变量str并将其初始化为null

  3. 遍历数组:使用for循环遍历数组中的每个元素,从第一个元素遍历到倒数第二个元素。

  4. 拼接字符串:在循环中,将当前元素与竖线符号(|)拼接到字符串变量str后面。

  5. 添加最后一个元素:在循环结束后,将数组最后一个元素与字符串变量str拼接起来。

  6. 打印结果:使用Console.WriteLine打印拼接后的字符串。

该代码的目的是将字符串数组中的元素以竖线(|)连接起来,形成一个字符串。这样的操作通常用于将多个字符串合并成一个字符串,以便于显示或处理。

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] name = { "老杨", "老苏", "老邹", "老虎", "老牛", "老马" };
            string str = null;

            for (int x = 0; x < name.Length - 1; x++)
                str += name[x] + "|";

            Console.WriteLine(str + name[name.Length - 1]);

            Console.ReadKey();
        }
    }
}

数组元素反转

这段代码的目的是将字符串数组中的元素反转并以竖线(|)连接起来进行输出。

  1. 定义字符串数组:使用String[] name定义一个包含多个姓名的字符串数组,并为数组元素赋予初始值。

  2. 声明临时变量:声明字符串变量tmp,用于在元素交换时暂存元素的值。

  3. 数组元素反转:使用for循环从数组的开头和末尾开始交换元素,将数组中的元素进行反转。

  4. 输出结果:使用for循环遍历反转后的数组,将每个元素与竖线符号(|)连接起来,并使用Console.Write逐个输出元素。

  5. 读取用户输入:使用Console.ReadKey等待用户按下任意键后程序结束。

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] name = { "老杨", "老苏", "老邹", "老虎", "老牛", "老马" };
            string tmp;

            for (int x = 0; x < name.Length / 2; x++)
            {
                tmp = name[name.Length - 1 - x];
                name[x] = name[name.Length - 1 - x];
                name[name.Length - 1 - x] = tmp;
            }

            for (int x = 0; x < name.Length - 1; x++)
                Console.Write(name[x] + " |"  );

            Console.ReadKey();
        }
    }
}

冒泡排序

这段代码实现了对整型数组进行排序,并输出排序结果。同时,使用了系统提供的方法进行排序和反向排序。

代码主要分为三个部分:

  1. Sort 方法:该方法用于实现冒泡排序算法,对传入的整型数组进行排序。使用两层循环进行比较和交换操作,将较大的元素逐步移到数组的末尾。

  2. Display 方法:该方法用于输出整型数组的元素。使用循环遍历数组,将每个元素输出到控制台。

  3. Main 方法:程序的入口点。在该方法中,定义了一个整型数组 MyArray 并初始化。然后调用 Sort 方法对数组进行排序,并调用 Display 方法输出排序结果。

    接下来,使用 Array.Sort 方法对数组进行排序,并使用 Array.Reverse 方法进行一次反向排序。

    最后,使用 Console.ReadKey 等待用户按下任意键后程序结束。

以上是代码的主要逻辑和功能。这段代码使用冒泡排序算法对整型数组进行排序,并通过自定义的方法和系统提供的方法分别输出排序结果。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        // 执行排序
        static void Sort(int[] Array)
        {
            for (int x = 0; x < Array.Length - 1; x++)
            {
                for (int y = 0; y < Array.Length - 1 - x; y++)
                {
                    if (Array[y] > Array[y + 1])
                    {
                        int tmp = Array[y];
                        Array[y] = Array[y + 1];
                        Array[y+1] = tmp;
                    }
                }
            }
        }

        // 输出结果
        static void Display(int[] Array)
        {
            for (int x = 0; x < Array.Length; x++)
            {
                Console.Write(Array[x] + " ");
            }
        }

        static void Main(string[] args)
        {
            int[] MyArray = new int[10] { 57, 32, 4, 96, 33, 11, 78, 3, 78, 2 };

            Sort(MyArray);
            Display(MyArray);

            // 使用系统提供的方法排序
            Array.Sort(MyArray);
            // 执行一次反向排序
            Array.Reverse(MyArray);

            Console.ReadKey();
        }
    }
}

直接插入排序

这段代码实现了插入排序算法,对整型数组进行排序,并输出排序结果。

代码主要包含两个部分:

  1. Sort 方法:该方法用于实现插入排序算法,对传入的整型数组进行排序。通过循环遍历数组元素,将当前元素插入已排序序列的正确位置。在每次遍历中,将当前元素与已排序序列的元素逐个比较并移动,直到找到合适的位置。

  2. Main 方法:程序的入口点。在该方法中,定义了一个整型数组 MyArray 并初始化。然后调用 Sort 方法对数组进行排序,并使用 foreach 循环输出排序结果。

最后,使用 Console.ReadKey 等待用户按下任意键后程序结束。

以上是代码的主要逻辑和功能。这段代码使用插入排序算法对整型数组进行排序,并输出排序结果。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        // 执行排序
        static void Sort(int[] Array)
        {
            for (int x = 0; x < Array.Length; x++)
            {
                int tmp = Array[x];
                int y = x;
                while ((y > 0) && (Array[y - 1] > tmp))
                {
                    Array[y] = Array[y-1];
                    --y;
                }
                Array[y] = tmp;
            }
        }

        static void Main(string[] args)
        {
            int[] MyArray = new int[10] { 57, 32, 4, 96, 33, 11, 78, 3, 78, 2 };

            Sort(MyArray);

            foreach (int x in MyArray)
                Console.Write(x + " ");

            Console.ReadKey();
        }
    }
}

选择排序

这段代码实现了选择排序算法,对整型数组进行排序,并输出排序结果。

代码主要包含两个部分:

  1. Sort 方法:该方法用于实现选择排序算法,对传入的整型数组进行排序。通过两层循环遍历数组元素,每次选择当前未排序部分中的最小元素,与未排序部分的第一个元素交换位置,将最小元素放在已排序部分的末尾。

  2. Main 方法:程序的入口点。在该方法中,定义了一个整型数组 MyArray 并初始化。然后调用 Sort 方法对数组进行排序,并使用 foreach 循环输出排序结果。

最后,使用 Console.ReadKey 等待用户按下任意键后程序结束。

以上是代码的主要逻辑和功能。这段代码使用选择排序算法对整型数组进行排序,并输出排序结果。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        // 执行排序
        static void Sort(int[] Array)
        {
            int min = 0;
            for (int x = 0; x < Array.Length; x++)
            {
                min = x;

                for (int y = x + 1; y < Array.Length; y++)
                {
                    if (Array[y] < Array[min])
                        min = y;
                }

                int tmp = Array[min];
                Array[min] = Array[x];
                Array[x] = tmp;
            }
        }

        static void Main(string[] args)
        {
            int[] MyArray = new int[10] { 57, 32, 4, 96, 33, 11, 78, 3, 78, 2 };

            Sort(MyArray);

            foreach (int x in MyArray)
                Console.Write(x + " ");

            Console.ReadKey();
        }
    }
}

定义二维数组

这段代码定义了一个二维数组 Array,并对其进行操作和输出。

代码主要包含以下几个部分:

  1. 定义二维数组:通过 int[,] 关键字定义一个二维数组,并使用初始化器 { { 1, 2, 4 }, { 4, 5, 6 } } 对数组进行初始化。

  2. 获取数组的行数和列数:使用 Array.Rank 获取数组的维度数(此处为 2),使用 Array.GetUpperBound(Array.Rank - 1) + 1 获取数组的列数。

  3. 遍历和输出数组元素:使用两层循环遍历二维数组的行和列,内层循环遍历列数,并将数组元素转换为字符串拼接在一起。然后使用 Console.WriteLine 输出每一行的元素。

  4. 最后,使用 Console.ReadKey 等待用户按下任意键后程序结束。

以上是代码的主要逻辑和功能。这段代码定义了一个二维数组,输出了数组的行数和列数,并遍历输出了数组的元素。

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 定义二维数组
            int[,] Array = new int[2,3]{{1,2,4},{4,5,6}};

            Console.WriteLine("数组行数为: {0}", Array.Rank);
            Console.WriteLine("数组列数为: {0}", Array.GetUpperBound(Array.Rank - 1) + 1);

            for (int x = 0; x < Array.Rank;x++ )
            {
                string str = "";
                for(int y=0;y< Array.GetUpperBound(Array.Rank-1)+1;y++)
                {
                    str = str + Convert.ToString(Array[x, y]) + " ";
                }
                Console.Write(str);
            }
            Console.ReadKey();
        }
    }
}

定义动态二维数组

这段代码实现了根据用户输入的行数和列数创建一个二维数组,并输出数组的索引信息。

代码主要包含以下几个部分:

  1. 通过 Console.ReadLine() 获取用户输入的行数和列数,并使用 Convert.ToInt32 将输入的字符串转换为整数类型,分别赋值给 RowCol 变量。

  2. 根据用户输入的行数和列数创建二维数组 Array

  3. 使用嵌套的循环遍历数组的每一个元素,外层循环控制行,内层循环控制列。在循环体内,使用 Console.Write 输出当前元素的索引信息,包括行号和列号,以便区分不同的元素。

  4. 在内层循环结束后,使用 Console.WriteLine 输出换行符,实现输出一行后换行。

  5. 最后,使用 Console.ReadKey 等待用户按下任意键后程序结束。

以上是代码的主要逻辑和功能。用户可以输入行数和列数,程序会根据输入创建一个二维数组,并输出数组中每个元素的索引信息。

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int Row = Convert.ToInt32(Console.ReadLine());
            int Col = Convert.ToInt32(Console.ReadLine());

            int[,] Array = new int[Row, Col];

            for (int x = 0; x < Row; x++)
            {
                for (int y = 0; y < Col; y++)
                {
                    Console.Write(x + "-->" + y.ToString() + " ");
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
    }
}

一维数组的合并

这段代码实现了将两个数组 Array1 和 Array2 合并成一个新的数组 Array3。

代码主要包含以下几个部分:

  1. 创建两个整数数组 Array1 和 Array2,分别赋值为 {1, 2, 3, 4, 5} 和 {6, 7, 8, 9, 10}。

  2. 计算合并后的数组长度,即 Array1.Length + Array2.Length,并将结果赋值给变量 Count。

  3. 创建一个新的整数数组 Array3,长度为 Count。

  4. 使用循环遍历数组 Array3,通过判断索引 x 的值来确定是从 Array1 还是 Array2 中取值。当 x 小于 Array1 的长度时,将 Array1[x] 的值赋给 Array3[x];当 x 大于等于 Array1 的长度时,将 Array2[x - Array1.Length] 的值赋给 Array3[x]。

  5. 使用 foreach 循环遍历数组 Array3,输出每个元素的值。

  6. 最后,使用 Console.ReadKey 等待用户按下任意键后程序结束。

以上是代码的主要逻辑和功能。它将两个数组合并成一个新的数组,并输出合并后的数组。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] Array1 = new int[] { 1, 2, 3, 4, 5 };
            int[] Array2 = new int[] { 6, 7, 8, 9, 10 };

            // 将Array1 与 Array2 合并成 Array3
            int Count = Array1.Length + Array2.Length;
            int[] Array3 = new int[Count];

            for (int x = 0; x < Array3.Length; x++)
            {
                if (x < Array1.Length)
                    Array3[x] = Array1[x];
                else
                    Array3[x] = Array2[x - Array1.Length];
            }

            foreach (int each in Array3)
                Console.Write(each + "  ");
            
            Console.ReadKey();
        }
    }
}

二维数组的合并

这段代码实现了将两个一维数组 Array1 和 Array2 合并到一个二维数组 Array3 中,并输出合并后的二维数组。

代码主要包含以下几个部分:

  1. 创建两个整数数组 Array1 和 Array2,分别赋值为 {1, 2, 3, 4, 5} 和 {6, 7, 8, 9, 10}。

  2. 创建一个二维整数数组 Array3,维度为 2 行 5 列,用于存储合并后的数据。

  3. 使用循环遍历二维数组 Array3,通过 switch-case 结构判断当前是处理 Array1 还是 Array2 的数据。

  4. 当 x = 0 时,通过内部的循环将 Array1 的数据逐个赋值给 Array3 的第一行。

  5. 当 x = 1 时,通过内部的循环将 Array2 的数据逐个赋值给 Array3 的第二行。

  6. 使用嵌套循环遍历二维数组 Array3,并使用 Console.Write 输出每个元素的值。外层循环控制行数,内层循环控制列数。

  7. 最后,使用 Console.ReadKey 等待用户按下任意键后程序结束。

以上是代码的主要逻辑和功能。它将两个一维数组合并到一个二维数组中,并输出合并后的二维数组。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] Array1 = new int[] { 1, 2, 3, 4, 5 };
            int[] Array2 = new int[] { 6, 7, 8, 9, 10 };

            // 将两个一维数组,合并到一个二维数组中
            int[,] Array3 = new int[2, 5];

            // Rank = 二维数组中的2
            for (int x = 0; x < Array3.Rank; x++)
            {
                switch (x)
                {
                    case 0:
                        {
                            for (int y = 0; y < Array1.Length; y++)
                                Array3[x, y] = Array1[y];
                            break;
                        }
                    case 1:
                        {
                            for (int z = 0; z < Array2.Length; z++)
                                Array3[x, z] = Array2[z];
                            break;
                        }
                }
            }

            // 输出二维数组中的数据
            for (int x = 0; x < Array3.Rank;x++ )
            {
                for(int y=0;y<Array3.GetUpperBound(Array3.Rank-1)+1;y++)
                    Console.Write(Array3[x, y] + " ");
                Console.WriteLine();
            }

            Console.ReadKey();
        }
    }
}

二维数组的拆分

这段代码实现了从一个二维数组 Array 中提取数据,并分别存储到两个一维数组 ArrayOne 和 ArrayTwo 中,并输出 ArrayOne 中的数据。

代码主要包含以下几个部分:

  1. 创建一个二维整数数组 Array,维度为 2 行 3 列,并初始化数组的值。

  2. 创建两个一维整数数组 ArrayOne 和 ArrayTwo,分别用于存储提取的数据。

  3. 使用嵌套循环遍历二维数组 Array。外层循环控制行数,内层循环控制列数。

  4. 在内层循环中,通过 switch-case 结构判断当前是处理第一行的数据还是第二行的数据。

  5. 当 x = 0 时,将当前元素 Array[x, y] 的值赋给 ArrayOne 数组中对应位置的元素 ArrayOne[y]。

  6. 当 x = 1 时,将当前元素 Array[x, y] 的值赋给 ArrayTwo 数组中对应位置的元素 ArrayTwo[y]。

  7. 使用 foreach 循环遍历 ArrayOne 数组,并使用 Console.WriteLine 输出每个元素的值。

  8. 最后,使用 Console.ReadKey 等待用户按下任意键后程序结束。

以上是代码的主要逻辑和功能。它从二维数组中提取数据,并分别存储到两个一维数组中,然后输出 ArrayOne 数组的数据。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] Array = new int[2, 3] { { 1, 3, 5 }, { 3, 4, 6 } };

            int[] ArrayOne = new int[3];
            int[] ArrayTwo = new int[4];

            for (int x = 0; x < 2; x++)
            {
                for(int y= 0; y<3; y++)
                {
                    switch(x)
                    {
                        case 0: ArrayOne[y] = Array[x, y]; break;
                        case 1: ArrayTwo[y] = Array[x, y]; break;
                    }
                }
            }

            foreach (int each in ArrayOne)
                Console.WriteLine(each);

             Console.ReadKey();
        }
    }
}

ArrayList 类位于System.Collections命名空间下,它可以动态添加和删除元素,可以将该数组类看作扩充了功能的数组。

动态数组创建

这段代码演示了如何使用 ArrayList 类来创建动态数组,并展示了一些基本操作。

代码主要包含以下几个部分:

  1. 创建了一个 ArrayList 对象 List,并设置其初始容量为 10。

  2. 使用 for 循环向 List 中添加了 9 个元素,从 0 到 8。

  3. 使用 List.Capacity 属性获取 List 的容量(即预分配的内部数组大小),并使用 List.Count 属性获取 List 中实际包含的元素数量。

  4. 使用 foreach 循环遍历 List,并输出每个元素的值。

  5. 创建一个普通整数数组 Array,其中包含 1 到 10 的元素。

  6. 使用 ArrayList 的另一个构造函数,将 Array 添加到新创建的 List1 中。

  7. 使用 for 循环遍历 List1,并输出每个元素的值。

  8. 使用 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用 ArrayList 创建动态数组,并展示了如何添加元素、获取容量和数量、以及遍历和输出数组元素的方法。

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 动态创建 ArrayList 并初始化10个数据
            ArrayList List = new ArrayList(10);
            for (int x = 0; x < 9; x++)
                List.Add(x);

            Console.WriteLine("可包含元素数量: {0} ", List.Capacity);
            Console.WriteLine("实际包含数量: {0}", List.Count);

            foreach (int each in List)
                Console.Write(each + " ");
            Console.WriteLine();

            // 将普通数组添加到ArrayList中
            int[] Array = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            ArrayList List1 = new ArrayList(Array);
            for (int x = 0; x < List1.Count; x++)
                Console.Write(List1[x] + "  ");

            Console.ReadKey();
        }
    }
}

增加/插入/删除元素

这段代码演示了使用 ArrayList 类进行数组操作的一些示例。

代码主要包含以下几个部分:

  1. 定义了一个静态方法 Display,用于遍历并显示 ArrayList 中的元素。

  2. 创建了一个 ArrayList 对象 List,并设置其初始容量为 10。

  3. 使用 List.Add 方法向 List 中添加了五个整数元素。

  4. 调用 Display 方法遍历并显示 List 中的元素。

  5. 使用 List.Insert 方法在指定位置插入元素。

  6. 再次调用 Display 方法遍历并显示更新后的 List

  7. 使用 List.Remove 方法移除指定元素。

  8. 再次调用 Display 方法遍历并显示更新后的 List

  9. 使用 List.RemoveAt 方法根据索引移除元素。

  10. 再次调用 Display 方法遍历并显示更新后的 List

  11. 使用 List.Contains 方法判断 List 是否包含指定元素,并将结果输出。

  12. 使用 List.RemoveRange 方法移除指定范围的元素。

  13. 再次调用 Display 方法遍历并显示更新后的 List

  14. 使用 List.Clear 方法清空所有元素。

  15. 使用 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用 ArrayList 进行动态数组操作,包括添加元素、插入元素、移除元素、判断是否包含元素、移除范围以及清空所有元素等操作。通过调用不同的方法,可以对 ArrayList 进行灵活的数组操作。

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Display(ArrayList x)
        {
            foreach (int each in x)
                Console.Write(each + "  ");
            Console.WriteLine();
        }

        static void Main(string[] args)
        {
            // 动态创建 ArrayList
            ArrayList List = new ArrayList(10);

            // 像数组增加数据
            List.Add(100);
            List.Add(200);
            List.Add(300);
            List.Add(400);
            List.Add(500);
            Display(List);

            // 插入数据
            List.Insert(1, 1000);
            List.Insert(2, 2000);
            Display(List);

            // 移除指定元素
            List.Remove(1000);
            Display(List);

            // 根据索引移除元素
            List.RemoveAt(1);
            Display(List);

            // 判断集合中是否包含指定元素
            bool ret = List.Contains(100);
            Console.WriteLine(ret);

            // 移除一个范围,从下标1开始向后移除3个元素
            List.RemoveRange(1, 3);
            Display(List);

            // 清空所有集合
            List.Clear();
            Console.ReadKey();
        }
    }
}

生成随机数存入集合

这段代码演示了使用 ArrayList 进行集合操作的一些示例。

代码主要包含以下几个部分:

  1. 创建了一个 ArrayList 对象 list

  2. 使用 list.AddRange 方法将一个整数数组添加到 list 中。

  3. 定义变量 summax,用于计算总和和最大值。初始时,将 max 设置为第一个元素的值。

  4. 使用循环遍历 list,计算总和和更新最大值。

  5. 输出最大值、总和和平均值(通过将总和除以元素数量)。

  6. 调用 list.Clear 方法清空 list 中的元素。

  7. 创建一个 Random 对象 rand,用于生成随机数。

  8. 使用循环生成随机数,并判断随机数是否已存在于 list 中。如果不存在,则将随机数添加到 list 中;如果已存在,则忽略该随机数,继续生成下一个随机数。

  9. 使用 foreach 循环遍历并输出 list 中的元素。

  10. 使用 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用 ArrayList 进行集合操作,包括计算总和、最大值和平均值,以及生成随机数并去重后放入集合中。通过使用 ArrayList 的方法和功能,可以方便地进行集合操作和处理。

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList list = new ArrayList();
            // 创建集合,添加数字,求平均值与和,最大值,最小值
            list.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
            int sum = 0;
            int max = (int)list[0];

            for (int x = 0; x < list.Count;x++ )
            {
                if((int)list[x] > max)
                    max = (int)list[x];
                sum += (int)list[x];
            }
            Console.WriteLine("最大值: {0} 总和: {1} 平均值: {2}",max,sum,sum/list.Count);

            list.Clear();
            // 用来生成随机数,并去重后放入list链表中
            Random rand = new Random();
            for (int x = 0; x < 10;x++ )
            {
                int num = rand.Next(0,10);
                // 判断集合中是否有这个随机数
                if (!list.Contains(num))
                    list.Add(num);
                else
                    x--;
            }
            foreach (int each in list)
                Console.WriteLine(each);

            Console.ReadKey();
        }
    }
}

增加并遍历数组

这段代码演示了使用 ArrayList 存储不同类型的数组,并对其进行遍历和访问的示例。

代码主要包含以下几个部分:

  1. 创建了一个 ArrayList 对象 list

  2. 使用 list.Add 方法将匿名数组和已定义的数组添加到 list 中。

  3. 使用循环遍历 list,对于其中的每个元素,检查其类型是否为数组类型(通过 is 关键字判断)。

  4. 如果元素是数组类型,则使用强制类型转换 ((int[])list[x]) 将其转换为 int[] 数组,并使用内部的 Length 属性获取数组长度。

  5. 使用嵌套循环遍历并输出数组中的元素。

  6. 使用 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了使用 ArrayList 存储不同类型的数组,并通过遍历和类型转换来访问这些数组的元素。通过使用 ArrayList,可以在一个集合中存储多种类型的数组,以便进行统一的处理和访问。

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList list = new ArrayList();
            
            // 直接追加匿名数组
            list.Add(new int[] { 1, 2, 3, 4, 5 });
            list.Add(new int[] { 6, 7, 8, 9, 10 });

            // 定义并追加数组
            int[] ptr = new int[5] { 100, 200, 300, 400, 500 };
            list.Add(ptr);

            for (int x = 0; x < list.Count;x++ )
            {
                if (list[x] is int[])
                {
                    for(int y=0; y < ((int[])list[x]).Length; y++)
                    {
                        Console.Write(((int[])list[x])[y] + "   ");
                    }
                    Console.WriteLine();
                }
            }
            Console.ReadKey();
        }
    }
}

增加遍历结构体

这段代码演示了使用 ArrayList 存储自定义的结构体,并对其进行遍历和访问的示例。

代码主要包含以下几个部分:

  1. 定义了一个名为 Student 的结构体,其中包含了三个字段:u_id(学生ID)、u_name(学生姓名)和 u_age(学生年龄)。

  2. 创建了一个 ArrayList 对象 list

  3. 定义了三个 Student 结构体实例 stu1stu2stu3,并分别初始化它们的字段值。

  4. 使用 list.Add 方法将这三个结构体实例添加到 list 中。

  5. 使用循环遍历 list,对于其中的每个元素,检查其类型是否为 Student 结构体类型(通过 is 关键字判断)。

  6. 如果元素是 Student 结构体类型,则使用强制类型转换 (Student)list[x] 将其转换为 Student 结构体,并访问其字段值。

  7. 输出每个学生的ID、姓名和年龄。

  8. 使用 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用 ArrayList 存储自定义的结构体,并通过遍历和类型转换来访问结构体的字段值。通过使用 ArrayList,可以在一个集合中存储多个结构体实例,以便进行统一的处理和访问。

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        public struct Student
        {
            public int u_id;
            public string u_name;
            public int u_age;

            public Student(int id, string name, int age)
            {
                this.u_id = id;
                this.u_name = name;
                this.u_age = age;
            }
        }

        static void Main(string[] args)
        {
            ArrayList list = new ArrayList();

            // 定义三个结构
            Student stu1 = new Student(1001,"admin",22);
            Student stu2 = new Student(1002, "guest", 33);
            Student stu3 = new Student(1003, "lyshark", 19);

            // 将结构追加到链表
            list.Add(stu1);
            list.Add(stu2);
            list.Add(stu3);

            // 遍历结构体
            for (int x = 0; x < list.Count;x++ )
            {
                if (list[x] is Student)
                {
                    Student ptr = (Student)list[x];
                    Console.WriteLine("ID: {0} 姓名: {1} 年龄: {2}", ptr.u_id, ptr.u_name, ptr.u_age);
                }
            }

           Console.ReadKey();
        }
    }
}

队列的使用

这段代码演示了使用 Queue(队列)的基本操作,包括入队、遍历和出队。

代码主要包含以下几个部分:

  1. 创建了一个 Queue 对象 queue

  2. 使用循环将数字从 0 到 9 入队,通过 Enqueue 方法将每个数字添加到队列中,并使用 queue.Count 输出队列中的元素数量。

  3. 使用 foreach 循环遍历队列中的元素,通过 Peek 方法查看队列的头部元素,然后输出队列头部元素和当前遍历的元素。

  4. 使用 Dequeue 方法弹出队列中的元素,将其转换为整数类型并输出弹出的元素值。

  5. 通过循环不断执行步骤 4,直到队列中的元素全部出队。

  6. 使用 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用 Queue 实现先进先出(FIFO)的数据结构。通过 Enqueue 方法可以将元素入队,通过 Dequeue 方法可以将元素出队,并使用 Peek 方法查看队列的头部元素,同时可以使用 Count 属性获取队列中的元素数量。队列常用于实现一些需要按照顺序处理数据的场景,例如任务队列、消息队列等。

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Queue queue = new Queue();

            // 入队
            for (int x = 0; x < 10;x++ )
            {
                queue.Enqueue(x);
                Console.WriteLine("{0} 入队 -> 队列计数: {1}", x,queue.Count);
            }
            // 遍历队列
            foreach(int each in queue)
            {
                Console.WriteLine("队列开始: {0} --> 队列元素: {1}", queue.Peek().ToString(),each);
            }
            // 弹出队列
            while(queue.Count !=0)
            {
                int value = (int)queue.Dequeue();
                Console.WriteLine("{0} 出队列.", value);
            }

           Console.ReadKey();
        }
    }
}

栈操作

这段代码演示了使用 Stack(栈)的基本操作,包括向栈中添加数据、查询栈顶元素、移出栈顶元素、遍历栈以及出栈操作。

代码主要包含以下几个部分:

  1. 创建了一个 Stack 对象 stack

  2. 使用循环将数字从 0 到 9 入栈,通过 Push 方法将每个数字添加到栈中。

  3. 使用 Peek 方法查询栈顶元素,并通过 Pop 方法移出栈顶元素。通过输出语句展示了当前栈顶元素和移出的栈顶元素。

  4. 使用 foreach 循环遍历栈中的元素,直接输出每个元素。

  5. 使用循环和 Pop 方法执行出栈操作,将栈中的元素逐个弹出并输出。

  6. 通过 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用 Stack 实现后进先出(LIFO)的数据结构。通过 Push 方法可以将元素入栈,通过 Pop 方法可以将栈顶元素移出栈,并使用 Peek 方法查询栈顶元素,同时可以使用 Count 属性获取栈中的元素数量。栈常用于实现一些需要按照相反顺序处理数据的场景,例如函数调用栈、表达式求值等。

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack stack = new Stack();

            // 向栈追加数据
            for (int x = 0; x < 10; x++)
                stack.Push(x);

            // 查询栈
            Console.WriteLine("当前栈顶元素为:{0}", stack.Peek().ToString());
            Console.WriteLine("移出栈顶元素:{0}", stack.Pop().ToString());
            Console.WriteLine("当前栈顶元素为:{0}", stack.Peek().ToString());

            // 遍历栈
            foreach (int each in stack)
                Console.WriteLine(each);

            // 出栈
            while(stack.Count !=0)
            {
                int pop = (int)stack.Pop();
                Console.WriteLine("{0} 出栈", pop);
            }

            Console.ReadKey();
        }
    }
}

Hashtable 表的使用

这段代码演示了使用 Hashtable(哈希表)的基本操作,包括添加键值对、移除哈希值、根据键查找值、遍历哈希表以及清空哈希表。

代码主要包含以下几个部分:

  1. 创建了一个 Hashtable 对象 hash

  2. 使用 Add 方法向哈希表中添加键值对,其中键和值可以是任意类型的对象。

  3. 使用 Remove 方法移除指定的键值对,这里移除了键为 "sex" 的项。

  4. 使用 Contains 方法根据键查找哈希表中是否存在指定的键或值。通过输出语句展示了根据键查找键值对和根据值查找键值对的结果。

  5. 使用 foreach 循环遍历哈希表中的键值对,通过 DictionaryEntry 类型的对象可以获取键和值。

  6. 使用 Clear 方法清空哈希表中的所有键值对。

  7. 通过 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用 Hashtable 来存储键值对数据,并进行基本的操作。哈希表是一种根据键来快速查找值的数据结构,具有快速的查找性能。注意,Hashtable 是非泛型集合,可以存储任意类型的键和值。在实际应用中,建议使用泛型集合 Dictionary<TKey, TValue> 来替代 Hashtable,因为泛型集合提供了类型安全和更好的性能。

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hash = new Hashtable();

            // 添加键值对 key = value
            hash.Add("id", 1001);
            hash.Add("name", "lyshark");
            hash.Add("sex", "男");
            Console.WriteLine("hash 元素个数: {0}", hash.Count);

            // 移除一个hash值
            hash.Remove("sex");

            // 根据hash查找 是否存在
            Console.WriteLine("根据key查找: {0}", hash.Contains("name"));
            Console.WriteLine("根据key查找: {0}", hash.ContainsValue("lyshark"));

            // 遍历hash表
            foreach (DictionaryEntry each in hash)
                Console.WriteLine(each.Key + "\t" + each.Value);
            Console.WriteLine();

            // 清空hash表
            hash.Clear();

            Console.ReadKey();
        }
    }
}

SortedList 有序哈希表

这段代码演示了使用 SortedList(有序列表)的基本操作,包括添加元素、判断值是否存在、遍历列表、删除元素以及获取键的集合。

代码主要包含以下几个部分:

  1. 创建了一个 SortedList 对象 student

  2. 使用 Add 方法向有序列表中添加键值对,其中键为学生的ID,值为学生的姓名。

  3. 使用 ContainsValue 方法判断是否存在某个值,如果不存在则添加键值对到列表中。

  4. 使用 foreach 循环遍历有序列表中的键值对,通过 DictionaryEntry 类型的对象可以获取键和值。

  5. 使用 Remove 方法删除指定的键值对,这里删除了键为 "1001" 的项。

  6. 使用 Keys 属性获取有序列表中的键的集合,并使用 foreach 循环遍历键的集合,通过键获取对应的值。

  7. 通过 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用 SortedList 来存储键值对数据,并进行基本的操作。有序列表是一种根据键进行排序的数据结构,可以快速查找和访问键值对。需要注意的是,有序列表是根据键的顺序进行排序的,而不是值的顺序。如果需要根据值进行排序,可以考虑使用其他集合类型,例如 List 结合自定义的排序逻辑或者使用 SortedDictionary

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedList student = new SortedList();

            // 向序列追加集合
            student.Add("1001", "Lucy");
            student.Add("1002", "Lily");
            student.Add("1003", "Tom");

            // 先判断是否存在某个值然后咋追加
            if (!student.ContainsValue("LyShark"))
                student.Add("1004", "LyShark");

            // 遍历学生数据
            foreach(DictionaryEntry each in student)
            {
                string id = each.Key.ToString();
                string name = each.Value.ToString();
                Console.WriteLine("ID: {0} 姓名: {1}", id, name);
            }

            // 删除一个数据
            student.Remove("1001");

            // 获取键的集合
            ICollection key = student.Keys;
            foreach(string each in key)
            {
                Console.WriteLine(each + "--> " + student[each]);
            }

            Console.ReadKey();
        }
    }
}

泛型类型集合

这段代码演示了使用泛型集合 List<T> 的基本操作,包括添加元素、批量添加元素、将泛型集合转换为数组以及将数组转换为泛型集合。

代码主要包含以下几个部分:

  1. 创建了一个泛型集合 List<int> 对象 list,并使用 Add 方法向集合中添加元素。

  2. 使用 AddRange 方法批量添加元素,可以传入数组或者另一个集合作为参数。

  3. 使用 ToArray 方法将泛型集合转换为数组,返回一个包含集合元素的数组。这里将 list 转换为 int[] 类型的数组,并输出数组的长度。

  4. 创建了一个字符数组 chs,并使用 ToList 方法将字符数组转换为泛型集合 List<char>。这里演示了将数组转换为泛型集合的操作。

  5. 通过 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用泛型集合 List<T> 来存储和操作具有相同类型的元素。泛型集合提供了强类型安全和更高效的操作,可以方便地进行元素的添加、删除、查找和转换等操作。通过泛型集合,可以在编译时进行类型检查,避免了装箱和拆箱的开销,并且提供了更好的性能和代码可读性。

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 创建泛型集合对象
            List<int> list = new List<int>();
            list.Add(1);
            list.Add(2);
            list.Add(3);

            list.AddRange(new int[] { 1, 2, 3, 4, 5, 6 });
            list.AddRange(list);

            // List泛型集合可以转换为数组
            int[] array = list.ToArray();
            Console.WriteLine("数组成员数: {0}", array.Length);


            // 字符数组转换为泛型集合
            char[] chs = new char[] { 'a', 'b', 'c' };
            List<char> list_char = chs.ToList();
            Console.WriteLine("字符数组成员数: {0}",list_char.Count);

            Console.ReadKey();
        }
    }
}

k-v泛型集合

这段代码演示了使用泛型集合 Dictionary<TKey, TValue> 的基本操作,包括添加键值对、遍历字典以及通过键访问值。

代码主要包含以下几个部分:

  1. 创建了一个泛型集合 Dictionary<int, string> 对象 dict,其中键的类型为 int,值的类型为 string

  2. 使用 Add 方法向字典中添加键值对。这里使用整数作为键,字符串作为值。

  3. 使用 foreach 循环遍历字典,通过 KeyValuePair<int, string> 类型的变量 each 获取每个键值对。在循环体内,输出每个键值对的键和值。

  4. 使用 foreach 循环遍历字典的键集合 dict.Keys,通过键访问对应的值。在循环体内,输出每个键和对应的值。

  5. 通过 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何使用泛型集合 Dictionary<TKey, TValue> 来存储和操作键值对。泛型字典提供了以键为索引快速查找值的功能,并且可以遍历字典中的键值对或者只遍历键。通过泛型字典,可以方便地根据键访问对应的值,并且具备高效的查找和访问性能。

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, string> dict = new Dictionary<int, string>();

            dict.Add(1, "张三");
            dict.Add(2, "李四");
            dict.Add(3, "王五");

            foreach(KeyValuePair<int,string> each in dict)
            {
                Console.WriteLine("序号:{0} 数值:{1}", each.Key, each.Value);
            }

            foreach(var each in dict.Keys)
            {
                Console.WriteLine("序号:{0} 数值:{1}", each, dict[each]);
            }

            Console.ReadKey();
        }
    }
}

k-v泛型集合

这段代码用于统计给定字符串中每个字符出现的次数,并将结果存储在字典中。

代码主要包含以下几个部分:

  1. 创建了一个字符串 str,内容为 "welcome to china"。

  2. 创建一个泛型字典 Dictionary<char, int>,用于存储每个字符及其出现的次数。其中键的类型为 char,值的类型为 int

  3. 使用 for 循环遍历字符串中的每个字符。如果当前字符是空格,则跳过本次循环。

  4. 在循环中,使用 ContainsKey 方法判断字典中是否已经包含当前字符作为键。如果包含,则将该键对应的值加1;否则,将该字符作为键,初始值设为1。

  5. 完成循环后,使用 foreach 循环遍历字典的键值对。通过 KeyValuePair<char, int> 类型的变量 each 获取每个键值对。在循环体内,输出每个字符及其出现的次数。

  6. 使用 Console.ReadKey 等待用户按下任意键后程序结束。

总结来说,这段代码演示了如何统计给定字符串中每个字符出现的次数,并使用泛型字典 Dictionary<TKey, TValue> 进行存储和操作。通过遍历字符串中的每个字符,可以判断字符是否已经在字典中存在,并根据情况进行相应的处理。最后,遍历字典输出每个字符及其出现的次数。这种方法可以快速统计字符串中各个字符出现的频率。

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String str = "welcome to china";
            // 对组统计出每个字符串出现的次数
            Dictionary<char, int> dict = new Dictionary<char, int>();
            for (int x = 0; x < str.Length;x++ )
            {
                if (str[x] == ' ')
                    continue;
                //如果dic已经包含了当前循环到的这个键
                if (dict.ContainsKey(str[x]))
                    dict[str[x]]++;
                // 这个字符在集合当中是第一次出现
                else
                    dict[str[x]] = 1;
            }

            // 遍历出数量
            foreach(KeyValuePair<char,int> each in dict)
            {
                Console.WriteLine("字母: {0} 出现了: {1} 次", each.Key, each.Value);
            }

            Console.ReadKey();
        }
    }
}
  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值