C# Index 定义索---引具体使用
using System.Collections.Generic;
namespace TestThisIndex
{
public class Program
{
static void Main(string[] args)
{
WLJ wlj = new WLJ();
List<Patient> list = new List<Patient>();
Patient patient = new Patient();
patient.Name = "wlj";
patient.NO = "11111";
patient.Sex = "男";
list.Add(patient);
patient = new Patient();
patient.Name = "wlj1";
patient.NO = "22222";
patient.Sex = "男";
list.Add(patient);
patient = new Patient();
patient.Name = "wlj3";
patient.NO = "33333";
patient.Sex = "男";
list.Add(patient);
patient = new Patient();
patient.Name = "wlj5";
patient.NO = "4444444";
patient.Sex = "男";
list.Add(patient);
patient = new Patient();
patient.Name = "wlj6";
patient.NO = "5555555";
patient.Sex = "男";
list.Add(patient);
wlj.Plist = list;
patient = new Patient();
patient = wlj[1];
System.Console.WriteLine(patient.NO + patient.Name);
patient = new Patient();
patient = wlj["第一个"];
System.Console.WriteLine(patient.NO + patient.Name);
System.Console.Read();
}
}
public class WLJ
{
List<Patient> list = new List<Patient>();
//定义了Index为int类型
public Patient this[int index]
{
get { return list[index]; }
set { list[index] = value; }
}
//定义了Index为string类型
public Patient this[string index]
{
get
{
switch (index)
{
case "第一个":
return list[0];
case "第二个":
return list[1];
case "第三个":
return list[2];
case "第四个":
return list[3];
default:
return list[4];
}
}
set
{
switch (index)
{
case "第一个":
list[0] = value;
break;
case "第二个":
list[1] = value;
break;
case "第三个":
list[2] = value;
break;
case "第四个":
list[3] = value;
break;
default:
list[4] = value;
break;
}
}
}
public List<Patient> Plist
{
get { return list; }
set { list = value; }
}
}
#region Patient and ExamResultS
/// <summary>
/// 病人基本信息
/// </summary>
public class Patient
{
/// <summary>
/// 姓名
/// </summary>
private string _Name = null;
public string Name
{
get { return _Name; }
set { _Name = value; }
}
/// <summary>
/// 性别
/// </summary>
private string _Sex = null;
public string Sex
{
get { return _Sex; }
set { _Sex = value; }
}
/// <summary>
/// 年龄
/// </summary>
private string _Age = null;
public string Age
{
get { return _Age; }
set { _Age = value; }
}
/// <summary>
/// 样本类型
/// </summary>
private string _SampleType = null;
public string SampleType
{
get { return _SampleType; }
set { _SampleType = value; }
}
/// <summary>
/// 病区
/// </summary>
private string _Wards = null;
public string Wards
{
get { return _Wards; }
set { _Wards = value; }
}
/// <summary>
/// 床号
/// </summary>
private string _BedNumber = null;
public string BedNumber
{
get { return _BedNumber; }
set { _BedNumber = value; }
}
/// <summary>
/// 编号
/// </summary>
private string _NO = null;
public string NO
{
get { return _NO; }
set { _NO = value; }
}
/// <summary>
/// 临床诊断
/// </summary>
private string _ClinicalDiagnosis = null;
public string ClinicalDiagnosis
{
get { return _ClinicalDiagnosis; }
set { _ClinicalDiagnosis = value; }
}
/// <summary>
/// 送检医生
/// </summary>
private string _SendDoctor = null;
public string SendDoctor
{
get { return _SendDoctor; }
set { _SendDoctor = value; }
}
/// <summary>
/// 检查者
/// </summary>
private string _Proofer = null;
public string Proofer
{
get { return _Proofer; }
set { _Proofer = value; }
}
/// <summary>
/// 审核人
/// </summary>
private string _Auditor = null;
public string Auditor
{
get { return _Auditor; }
set { _Auditor = value; }
}
/// <summary>
/// 接收时间
/// </summary>
private DateTime _ReceiveTime;
public DateTime ReceiveTime
{
get { return _ReceiveTime; }
set { _ReceiveTime = value; }
}
/// <summary>
/// 报告时间
/// </summary>
private DateTime _ReportTime;
public DateTime ReportTime
{
get { return _ReportTime; }
set { _ReportTime = value; }
}
private ExamResultS _ExamResult;
public ExamResultS ExamResult
{
get
{
if (_ExamResult == null)
{
_ExamResult = new ExamResultS();
return _ExamResult;
}
else
{
return _ExamResult;
}
}
set { _ExamResult = value; }
}
}
/// <summary>
/// 检验结果
/// </summary>
public class ExamResultS
{
/// <summary>
/// 检验项目
/// </summary>
private string _ExamItem = null;
public string ExamItem
{
get { return _ExamItem; }
set { _ExamItem = value; }
}
/// <summary>
/// 结果
/// </summary>
private string _Result = null;
public string Result
{
get { return _Result; }
set { _Result = value; }
}
/// <summary>
/// 单位
/// </summary>
private string _Unit = null;
public string Unit
{
get { return _Unit; }
set { _Unit = value; }
}
/// <summary>
/// 参考值
/// </summary>
private string _ReferenceValue = null;
public string ReferenceValue
{
get { return _ReferenceValue; }
set { _ReferenceValue = value; }
}
}
#endregion
}
C# Index 定义索---引具体使用的更多相关文章
- C# Index 定义索---引具体使用2
窗体代码 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;usi ...
- windows server 2008 r2 启用索引(转)
08r2的“windows search”服务默认是不安装的,要想启用索引执行下列步骤: 1.打开“服务器管理”——选中“角色”——右边选中“添加角色”——勾选“文件服务”. 2. ...
- elasticsearch 了解多少,说说你们公司 es 的集群架构,索 引数据大小,分片有多少,以及一些调优手段 ?
面试官:想了解应聘者之前公司接触的 ES 使用场景.规模,有没有做过比较大 规模的索引设计.规划.调优. 解答: 如实结合自己的实践场景回答即可. 比如:ES 集群架构 13 个节点,索引根据通道不同 ...
- elasticsearch 了解多少,说说你们公司 es 的集群架构,索 引数据大小,分片有多少,以及一些调优手段 。
面试官:想了解应聘者之前公司接触的 ES 使用场景.规模,有没有做过比较大 规模的索引设计.规划.调优. 解答: 如实结合自己的实践场景回答即可. 比如:ES 集群架构 13 个节点,索引根据通道不同 ...
- CREATE INDEX - 定义一个新索引
SYNOPSIS CREATE [ UNIQUE ] INDEX name ON table [ USING method ] ( { column | ( expression ) } [ opcl ...
- index 定义 v-for 未使用变量 实际是没有 :key="index"
需要有 :key="index" <Checkbox :label="item.key" :key="index" v-for=&qu ...
- 15 MySQL--索引
索引: http://www.cnblogs.com/linhaifeng/articles/7356064.html http://www.cnblogs.com/linhaifeng/articl ...
- 数据库——SQL数据定义
数据定义 SQL的数据定义语句 操 作 对 象 操 作 方 式 创 建 删 除 修 改 表 CREATE TABLE DROP TABLE ALTER TABLE 视 图 CREATE ...
- 小甲鱼PE详解之IMAGE_OPTIONAL_HEADER32 结构定义即各个属性的作用(PE详解03)
咱接着往下讲解IMAGE_OPTIONAL_HEADER32 结构定义即各个属性的作用! (视频教程:http://fishc.com/a/shipin/jiemixilie/) 接着我们来谈谈 IM ...
随机推荐
- libevent使用
(sudo apt-get install libevent-dev) 1:安装libevent 用wget指令直接下载libevent:# wget http://www.monkey.org/~p ...
- .NET中 MEF应用于IOC
IOC解释 IOC,控制反转的意思.所谓依赖,从程序的角度看,就是比如A要调用B的方法,那么A就依赖于B,反正A要用到B,则A依赖于B.所谓反转,你必须理解如果不反转,会怎么着,因为A必须要有B,才可 ...
- Qt版helloworld
跟学别的编程语言一样,Qt也不例外,一开始就想写一个helloworld.初学Qt十几天,看了一点关于Qt视频的介绍和书上的基础知识,对于Qt写工程的概念有了初步的认识,就代码的形式来说,Qt Cre ...
- ubuntu 14.04链接无线路由,建立无线和有线链接
神奇的linux. 废话不多说,进入主题: 首先1:买一部带wifi的笔记本电脑,买一个可用的无线路由器,像网络提供商申请上网缴费==! 2,中国国情,我们大多都是用ADSL咯.所以其它情况就不说了. ...
- 关于 iOS10 更新后 360 云盘 的上传按钮消失的解决方案
最近出了iOS10,作为iOS开发者,果断更新. 但是更新完后,打开自己的360云盘,发现想向云盘上传东西,但是传不了,加号按钮不见了. 经过我的研究,原因是 下面的自定义tabbar放置加号按钮的方 ...
- HDU 4811 Ball 贪心
题目链接: 题目 Ball Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 问题描述 ...
- 【POJ】【2348】Euclid‘s Game
博弈论 题解:http://blog.sina.com.cn/s/blog_7cb4384d0100qs7f.html 感觉本题关键是要想到[当a-b>b时先手必胜],后面的就只跟奇偶性有关了 ...
- [转载]C# winform登陆框验证码的实现
验证码技术已愈来愈成熟,从最初的数字.字母.字符.汉字已经到目前的语言,其应用也甚广,之前大多数只有在网站上可以看到,现在在一些客户端软件也经常可见(比如证券相关软件).之前做的一个基于 C# 客户端 ...
- oracle Execute Immediate 用法
包含using into用法. Declare v_sid Integer:=20020101; v_sql Varchar2(100); v_resul ...
- [51 nod]1009 数字1的数量
1009 数字1的数量 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 给定一个十进制正整数N,写下从1开始,到N的所有正数,计算出其中出现所有1的个数. 例如: ...