- 博客(6)
- 收藏
- 关注
原创 C#集合的练习
写一个长度为10的集合,要求在里面随机地存放10个数字(0-9) 要求所有数字不重复 ArrayList list = new ArrayList(); Random r = new Random(); //如果写 i<list.Count ,Count表示实际存在的数,实际上集合为0,条件不成立,所以不会执行 for(int i=0;i<10;i++) { i.
2021-02-04 16:04:52 94
原创 C#集合的长度问题
using System;using System.Collections;namespace 集合的长度{ class Program { static void Main(string[] args) { ArrayList list = new ArrayList(); list.Add(1); list.Add(2); list.Add(1);
2021-02-04 16:04:03 2612 1
原创 C#集合
using System;using System.Collections;namespace 集合{ class Program { static void Main(string[] args) { //创建集合 (集合:可以添加任意类型的元素,且长度可以任意改变) ArrayList list = new ArrayList(); //添加单个元素 索引从[0]开始
2021-02-04 16:03:23 30
原创 C# 里式转换
using System;namespace 里式转换练习{ class Program { static void Main(string[] args) { //创建 人类 学生 老师 野兽 美女 五个对象 //每次调用此程序时, 都随机输出不同人的打招呼 Person[] pers = new Person[6]; //利用随机数
2021-02-04 14:39:09 62
原创 C#继承
using System;namespace 继承{ class Program { static void Main(string[] args) { Student s1 = new Student("张三",14); Console.WriteLine("姓名:"+s1.name+"年龄:"+s1.age ); Console.ReadKey(); }
2021-02-03 10:26:13 56
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人