C# Index 定义索---引具体使用2
窗体代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WLJTLongtengGenesAndSupreme.TestThisIndex
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Patient dd = new Patient();
this.propertyGrid1.SelectedObject =dd;
}
}
}
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.ComponentModel;
namespace WLJTLongtengGenesAndSupreme.TestThisIndex
{
public class Haha
{
static void Main(string[] args)
{
#region MyRegion
//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();
#endregion
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
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;
[DefaultValue("fffff")]
[Category("第一类")]
[Description("这是一个姓名,主要适用于标志信息")]
public string Name
{
get { return _Name; }
set { _Name = value; }
}
/// <summary>
/// 性别
/// </summary>
private string _Sex = null;
[DefaultValue("男")]
public string Sex
{
get { return _Sex; }
set { _Sex = value; }
}
/// <summary>
/// 年龄
/// </summary>
private string _Age = null;
[DefaultValue("12")]
public string Age
{
get { return _Age; }
set { _Age = value; }
}
/// <summary>
/// 样本类型
/// </summary>
private string _SampleType = null;
[DefaultValue("哈哈哈")]
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 = new ExamResultS();
public ExamResultS ExamResult
{
get
{
if (_ExamResult == null)
{
_ExamResult = new ExamResultS();
return _ExamResult;
}
else
{
return _ExamResult;
}
}
set { _ExamResult = value; }
}
private dddd ddd =null;
public dddd DDDD
{
get
{
if (ddd == null)
{
ddd = new dddd();
return ddd;
}
else
{
return ddd;
}
}
set { ddd = value; }
}
public Patient() {
this.Name = "FFF";
this.NO = "1111";
//this.ExamResult = new ExamResultS() { ExamItem = "111", ReferenceValue = "222", Result = "333", Unit = "44" };
}
}
public class dddd : List<ExamResultS>
{
}
/// <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; }
}
public ExamResultS() {
this.ExamItem = "111";
this.ReferenceValue = "222"; this.Result = "333"; this.Unit = "44";
}
}
#endregion
}
C# Index 定义索---引具体使用2的更多相关文章
- C# Index 定义索---引具体使用
using System;using System.Collections.Generic;namespace TestThisIndex{ public class Program { ...
- 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 ...
随机推荐
- 【Nhibernate】入门 踩雷篇
总结(喜欢写在前面,记性不好老忘记解决问题时的思路): 使用框架一般不会完整的看文档,直接上来就搞,踩雷是必须的,重要的是遇到雷的时候要快速变换思路,是不是姿势不对(文件位置不对) 提高解决问题的速度 ...
- MVC 删除文件
protected void DeleteTempFiles(string iFileName) { FileInfo f = new FileInfo(iFileName); DirectoryIn ...
- CADisplayLink
什么是CADisplayLink CADisplayLink是一个能让我们以和屏幕刷新率相同的频率将内容画到屏幕上的定时器.我们在应用中创建一个新的 CADisplayLink 对象,把它添加到一个r ...
- 保持程序在后台长时间运行-b
iOS为了让设备尽量省电,减少不必要的开销,保持系统流畅,因而对后台机制采用墓碑式的“假后台”.除了系统官方极少数程序可以真后台,一般开发者开发出来的应用程序后台受到以下限制:1.用户按Home之后, ...
- C++拷贝构造函数详解(转载)
一. 什么是拷贝构造函数 首先对于普通类型的对象来说,它们之间的复制是很简单的,例如: int a = 100; int b = a; 而类对象与普通对象不同,类对象内部结构一般较为复杂,存在各种成员 ...
- 阿旭的php开发环境
过了几年,php技术也日新月异,变化也挺多.哪么对于开发者,感觉有一些简单的方法,写下来,以备以后使用.我觉得吧,Linux写php不如windows写php,调试,查资料和各种功能比较全面,而lin ...
- javascript中alert()与console.log()的区别
我们在做js调试的时候使用 alert 可以显示信息,调试程序,alert 弹出窗口会中断程序, 如果要在循环中显示信息,手点击关闭窗口都累死.而且 alert 显示对象永远显示为[object ]. ...
- watch your tone
老板要求邮件注意语气... 木想到混了这么久这种事情还要老板提醒
- 2014 Multi-University Training Contest 10
官方解题报告:http://blog.sina.com.cn/s/blog_6bddecdc0102v01l.html A simple brute force problem. http://acm ...
- 坑人的 try catch finally
一直以为这样可以关闭 fs, 其实不行 static void Main(string[] args) { FileStream fs = null; try { fs = new FileStrea ...