C#基础第四天-作业答案-Hashtable-list<KeyValuePair>泛型实现名片
.Hashtable 实现 Hashtable table = new Hashtable();
while (true)
{
Console.WriteLine("------------------1.增加--------------------");
Console.WriteLine("------------------2.查询--------------------");
Console.WriteLine("------------------3.查询全部----------------");
Console.WriteLine("------------------4.删除--------------------");
Console.WriteLine("请输入你要使用的功能:");
int num = int.Parse(Console.ReadLine());
switch (num)
{
case :
Console.WriteLine("请输入姓名:");
string name = Console.ReadLine();
Console.WriteLine("请输入年龄 性别 爱好 联系方式:");
string str = Console.ReadLine();
table.Add(name, str);
break;
case :
Console.WriteLine("请输入姓名:");
string nameQuery = Console.ReadLine();
Console.WriteLine();
if (table.Contains(nameQuery))
{
Console.WriteLine(nameQuery + " " + table[nameQuery]);
}
break;
case :
Console.WriteLine();
foreach (DictionaryEntry d in table)
{
Console.WriteLine(d.Key + " " + d.Value);
}
break;
case :
Console.WriteLine("请输入姓名:");
string delete = Console.ReadLine();
table.Remove(delete); break;
} :list<KeyValuePair>泛型实现 List<KeyValuePair<string, string>> listkey = new List<KeyValuePair<string, string>>();
while (true)
{
Console.WriteLine("------------------1.增加--------------------");
Console.WriteLine("------------------2.查询--------------------");
Console.WriteLine("------------------3.查询全部----------------");
Console.WriteLine("------------------4.删除--------------------");
Console.WriteLine("请输入你要使用的功能:");
int num = int.Parse(Console.ReadLine());
switch (num)
{
case :
Console.WriteLine("请输入添加的姓名:");
string name = Console.ReadLine();
Console.WriteLine("请输入年龄 性别 爱好 联系方式:");
string str = Console.ReadLine();
listkey.Add(new KeyValuePair<string, string>(name, str));
Console.WriteLine("成功");
break;
case :
Console.WriteLine("请输入查找的姓名:");
string nameQuery = Console.ReadLine();
Console.WriteLine();
if (listkey)
{
Console.WriteLine(nameQuery + " " + listkey[nameQuery]);
}
Console.WriteLine("成功");
break;
case :
Console.WriteLine("查找全部");
foreach (DictionaryEntry d in listkey)
{
Console.WriteLine(d.Key + " " + d.Value);
}
Console.WriteLine("成功");
break;
case :
Console.WriteLine("请输入删除的姓名:");
string delete = Console.ReadLine();
table.Remove(delete);
Console.WriteLine("成功");
break;
}
本系列教程:
C#基础总结之八面向对象知识点总结-继承与多态-接口-http://www.cnblogs.com/spring_wang/p/6113531.html
C#基础总结之七面向对象知识点总结1http://www.cnblogs.com/spring_wang/p/6113526.html
C#基础总结之六 DataTable (临时表/数据源) 和Datatable 名片练习http://www.cnblogs.com/spring_wang/p/6113520.html
C#基础总结之五Dictionary<string, string[]>和while循环http://www.cnblogs.com/spring_wang/p/6113514.html
C#基础总结之四List-Hashtable-冒泡排序http://www.cnblogs.com/spring_wang/p/6113504.html
C#基础总结之三循环控制-for-数组-乘法表-arraylisthttp://www.cnblogs.com/spring_wang/p/6113496.html
C#基础总结之二循环控制-运算符http://www.cnblogs.com/spring_wang/p/6113484.html
C#基础总结之一变量常量-if嵌套语句-witch结构-类型转换http://www.cnblogs.com/spring_wang/p/6113476.html
C#基础课程之六(临时表)DataTable使用方法http://www.cnblogs.com/spring_wang/p/6113454.html
C#基础课程之五集合(HashTable,Dictionary)http://www.cnblogs.com/spring_wang/p/6113404.html
C#基础课程之四集合(ArrayList、List<泛型>)http://www.cnblogs.com/spring_wang/p/6113396.html
C#基础课程之三循环语句http://www.cnblogs.com/spring_wang/p/6113383.html
C#基础课程之二变量常量及流程控制http://www.cnblogs.com/spring_wang/p/6113372.html
C#基础课程之一注释和控制台、一些常识http://www.cnblogs.com/spring_wang/p/6113361.html
C#基础第九天-作业答案-储蓄账户(SavingAccount)和信用账户(CreditAccount) http://www.cnblogs.com/spring_wang/p/6113291.html
C#基础第九天-作业-储蓄账户(SavingAccount)和信用账户(CreditAccount) http://www.cnblogs.com/spring_wang/p/6113285.html
C#基础第八天-作业答案-设计类-面向对象方式实现两个帐户之间转账http://www.cnblogs.com/spring_wang/p/6113274.html
C#基础第八天-作业-设计类-面向对象方式实现两个帐户之间转账http://www.cnblogs.com/spring_wang/p/6113258.html
C#基础第七天-作业答案-利用面向对象的思想去实现名片-动态添加http://www.cnblogs.com/spring_wang/p/6113232.html
C#基础第七天-作业-利用面向对象的思想去实现名片-动态添加http://www.cnblogs.com/spring_wang/p/6113224.html
C#基础第六天-作业-利用面向对象的思想去实现名片http://www.cnblogs.com/spring_wang/p/6113028.html
C#基础第六天-作业答案-利用面向对象的思想去实现名片http://www.cnblogs.com/spring_wang/p/6113033.html
C#基础第五天-作业答案-用DataTable制作名片集http://www.cnblogs.com/spring_wang/p/6113022.html
C#基础第五天-作业-用DataTable制作名片集http://www.cnblogs.com/spring_wang/p/6113013.html
C#基础第四天-作业答案-Hashtable-list<KeyValuePair>泛型实现名片http://www.cnblogs.com/spring_wang/p/6113005.html
C#基础第四天-作业-Hashtable-list<KeyValuePair>泛型实现名片http://www.cnblogs.com/spring_wang/p/6113000.html
C#基础第三天-作业答案-集合-冒泡排序-模拟名片http://www.cnblogs.com/spring_wang/p/6112888.html
C#基础第三天-作业-集合-冒泡排序-模拟名片http://www.cnblogs.com/spring_wang/p/6112885.html
C#基础第二天-作业答案-九九乘法表-打印星星http://www.cnblogs.com/spring_wang/p/6112881.html
C#基础第二天-作业-九九乘法表-打印星星http://www.cnblogs.com/spring_wang/p/6112875.html
C#基础第一天-作业答案http://www.cnblogs.com/spring_wang/p/6112872.html
C#基础第一天-作业http://www.cnblogs.com/spring_wang/p/6112867.html
C#-string.Format对C#字符串格式化http://www.cnblogs.com/spring_wang/p/6077098.html
C#基础第四天-作业答案-Hashtable-list<KeyValuePair>泛型实现名片的更多相关文章
- C#基础第七天-作业答案-利用面向对象的思想去实现名片-动态添加
class Card { private string name; public string Name { get { return name; } set { name = value; } } ...
- C#基础第五天-作业答案-用DataTable制作名片集
.DataTable 实现 DataTable PersonCard = new DataTable(); //创建一个DataTable DataTable PersonCardCopy = new ...
- C#基础第四天-作业-Hashtable-list<KeyValuePair>泛型实现名片
1.名片集: 名片集实现功能:不限定集合实现 增加,查询,查询全部,删除 功能,需求条件: 根据姓名去(查询/删除)某一行数据.指定:姓名,年龄,性别,爱好,联系方式. 采用技术:Hashtable- ...
- C#基础第三天-作业答案-集合-冒泡排序-模拟名片
.冒泡排序 Console.WriteLine("对集合里的数进行排序,请输入第一个数:"); int a = int.Parse(Console.ReadLine()); Con ...
- C#基础第七天-作业-利用面向对象的思想去实现名片-动态添加
1.利用面向对象的思想去实现: (增加,修改,删除,查询,查询全部)需求:根据人名去(删除/查询).指定列:姓名,年龄,性别,爱好,电话. 多条添加 , 动态添加 名片 本系列教程: C#基础总结之八 ...
- 前端-JavaScript2-1——JavaScript基础复习及上次作业答案
昨天讲解的JS是编程最最简单的一些基础知识,复习一下: JavaScript书写环境,<script>标签 1 <script type=”text/javascript”&g ...
- C语言基础第四次作业
题目7-2,九九乘法表 1.实验代码: #include<stdio.h> int main() { int N, i, j, q; scanf("%d",&N ...
- C#基础第九天-作业答案-储蓄账户(SavingAccount)和信用账户(CreditAccount)
class Bank { //Dictionary<long,Account> dictionary=new Dictionary<long,Account>(); DataT ...
- C#基础第八天-作业答案-设计类-面向对象方式实现两个帐户之间转账
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
随机推荐
- server.xml引入子文件配置(tomcat虚拟主机)[转]
在配置tomcat虚拟主机时候,如何每一个虚拟主机写成单独文件,server.xml包含这些子文件? 如以下<OneinStack>中,添加JAVA环境虚拟主机后tomcat配置文件详情: ...
- HDU2717 Catch That Cow 【广搜】
Catch That Cow Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
- 这是一份很详细的 Retrofit 2.0 使用教程(含实例讲解)(转)
前言 在Andrroid开发中,网络请求十分常用 而在Android网络请求库中,Retrofit是当下最热的一个网络请求库 今天,我将献上一份非常详细Retrofit v2.0的使用教程,希望你们会 ...
- 【转发】JQuery中操作Css样式的方法
JQuery中操作Css样式的方法 //1.获取和设置样式 $("#tow").attr("class")获取ID为tow的class属性 $("#t ...
- Spark ML 几种 归一化(规范化)方法总结
规范化,有关之前都是用 python写的, 偶然要用scala 进行写, 看到这位大神写的, 那个网页也不错,那个连接图做的还蛮不错的,那天也将自己的博客弄一下那个插件. 本文来源 原文地址:htt ...
- vmware安装找不到虚拟网卡解决方案
前一段实际,win7升级到win10发现vmware12没有虚拟网卡vnet1/vnet8.这不坑爹吗,没网卡能通信吗? 在网上搜寻一下发现可以重置网络,即可再次安装虚拟网卡...算是对问题的记录学习 ...
- Spring Cloud环境搭建: Eureka Server
项目目录结构, 总共三个文件 ├── pom.xml └── src ├── main │ ├── java │ │ └── com │ │ └── rockbb │ │ ...
- linux c server and client 简单的通信
server.c #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <st ...
- FlipViewDemo
error: Resource entry white is already defined. error: Resource entry transparentBlack is already de ...
- Mac系统清理、占用空间大、空间不够、查看系统文件大小分布
背景: 最近老提示空间不够,很尴尬,一直弹系统提示 如图,256的空间,就剩下几个G了,其中最大头的系统占用:160G,占比60%多 正常情况下:我们可以点击管理,进入到系统磁盘优化界面: 这种适用于 ...