关于List,head first系列,p323
来源:互联网 发布:如何考核软件开发 编辑:程序博客网 时间:2024/05/18 20:05
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
List<string> a = new List<string>(); //0,1,3,4,4.2
string zilch = "zero";
string first = "one";
string second = "two";
string third = "three";
string fourth = "4.2";
string twopointtwo = "2.2";
a.Add(zilch); //0,1,2,3
a.Add(first);
a.Add(second);
a.Add(third);
if (a.Contains("three")) //0,1,2,3,4
{
a.Add("four");
}
a.RemoveAt(2);//去掉2 0,1,3,4
if (a.IndexOf("four") != 4) //加4.2 0,1,3,4,4.2
{
a.Add(fourth);
}
if (a.Contains("two")) //没有2啊!,不加入2.2
{
a.Add(twopointtwo);
}
printL(a);
}
public void printL(List<string> a)
{
string result = "";
foreach (string element in a)
{
result += "\n" + element;
}
// MessageBox.Show("result");
MessageBox.Show(result); //注意单双引号的区分
}
}
}
- 关于List,head first系列,p323
- Head first系列图书
- Head First系列下载
- Head First系列书籍
- Head First系列
- 谈谈head first系列
- 关于 Head First SQL 中文版
- 关于Head First Servlet&Jsp。。
- Head First
- Head First
- ?head first ???? ????? ????
- Servlets与JSP初学(书籍:head first系列)
- IT经典书籍——Head First系列…
- Head First Design Patterns
- Head First Design Patterns
- head first ejb(finally)
- Head First Design Patterns
- Head First Java
- C#.net winform skin 皮肤大全(转)
- 在数据库中增加aspnet_XXXX 开头的表,以方便在程序中使用Membership。API
- poj 2192
- 让系分来的更猛烈些吧
- 运行库和运行期检查 --《软件调试》笔记
- 关于List,head first系列,p323
- Boost 库 Enable_shared_from_this 实现原理分析
- java中的深复制和浅复制
- Eclipse 快捷大全
- struts2知识点
- Word中形如^p等27种分节符的奇妙用法!
- C/C+语言struct深层探索
- objdump 符号表输出格式
- break与continue的区别