using System;
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 定义索---引具体使用的更多相关文章

  1. C# Index 定义索---引具体使用2

    窗体代码 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;usi ...

  2. w​i​n​d​o​w​s​ ​s​e​r​v​e​r​ ​2​0​0​8​ ​r​2​ ​启​用​索​引(转)

    08r2的“windows search”服务默认是不安装的,要想启用索引执行下列步骤:        1.打开“服务器管理”——选中“角色”——右边选中“添加角色”——勾选“文件服务”.    2. ...

  3. elasticsearch 了解多少,说说你们公司 es 的集群架构,索 引数据大小,分片有多少,以及一些调优手段 ?

    面试官:想了解应聘者之前公司接触的 ES 使用场景.规模,有没有做过比较大 规模的索引设计.规划.调优. 解答: 如实结合自己的实践场景回答即可. 比如:ES 集群架构 13 个节点,索引根据通道不同 ...

  4. elasticsearch 了解多少,说说你们公司 es 的集群架构,索 引数据大小,分片有多少,以及一些调优手段 。

    面试官:想了解应聘者之前公司接触的 ES 使用场景.规模,有没有做过比较大 规模的索引设计.规划.调优. 解答: 如实结合自己的实践场景回答即可. 比如:ES 集群架构 13 个节点,索引根据通道不同 ...

  5. CREATE INDEX - 定义一个新索引

    SYNOPSIS CREATE [ UNIQUE ] INDEX name ON table [ USING method ] ( { column | ( expression ) } [ opcl ...

  6. index 定义 v-for 未使用变量 实际是没有 :key="index"

    需要有 :key="index" <Checkbox :label="item.key" :key="index" v-for=&qu ...

  7. 15 MySQL--索引

    索引: http://www.cnblogs.com/linhaifeng/articles/7356064.html http://www.cnblogs.com/linhaifeng/articl ...

  8. 数据库——SQL数据定义

    数据定义  SQL的数据定义语句 操 作 对 象 操  作  方  式 创  建 删  除 修  改 表 CREATE TABLE DROP TABLE ALTER TABLE 视  图 CREATE ...

  9. 小甲鱼PE详解之IMAGE_OPTIONAL_HEADER32 结构定义即各个属性的作用(PE详解03)

    咱接着往下讲解IMAGE_OPTIONAL_HEADER32 结构定义即各个属性的作用! (视频教程:http://fishc.com/a/shipin/jiemixilie/) 接着我们来谈谈 IM ...

随机推荐

  1. ThinkPHP/Common/extend.php

    <?php // +---------------------------------------------------------------------- // | ThinkPHP [ ...

  2. 理解PHP 依赖注入|Laravel IoC容器

    看Laravel的IoC容器文档只是介绍实例,但是没有说原理,之前用MVC框架都没有在意这个概念,无意中在phalcon的文档中看到这个详细的介绍,感觉豁然开朗,复制粘贴过来,主要是好久没有写东西了, ...

  3. Ajax 完整教程

    第 1 页 Ajax 简介 Ajax 由 HTML.JavaScript™ 技术.DHTML 和 DOM 组成,这一杰出的方法可以将笨拙的 Web 界面转化成交互性的 Ajax 应用程序.本文的作者是 ...

  4. google calendar

    1. user guide on google https://developers.google.com/google-apps/calendar/instantiate 2. google app ...

  5. win8 telnet VirtualBox中的redhat9

    1. VirtualBox设置网络连接为“桥接网卡”,并且此网卡要为win8正在使用的网卡(比如我的电脑上使用的就是无线网卡,则选择网卡时也要用无线网卡) 2. 在redhat的终端里,运行ifcon ...

  6. 关于12306登陆页面dynamicJs的获取

    今天帮与一个朋友探讨此事,刚开始一直是以为访问404,但是发现返回为200,没有问题,后来才知道朋友想了解的是为何浏览器可以获取到/otn/dynamicJs,但是自己手动获取就获取不到了 找了很久r ...

  7. 【POJ】【2975】Nim

    博弈论 我哭……思路错误WA了6次?(好像还有手抖点错……) 本题是要求Nim游戏的第一步必胜策略有几种. 一开始我想:先全部异或起来得到ans,从每个比ans大的堆里取走ans个即可,答案如此累计… ...

  8. hdu 3807

    很好的思路     枚举有多少人有ipad 判是否满足题目给出的条件 #include <iostream> #include <cstring> #include <c ...

  9. oracle sql 性能 优化

    目录[-] (1) 选择最有效率的表名顺序(只在基于规则的优化器中有效):ORACLE的解析器按照从右到左的顺序处理FROM子句中的表名,FROM子句中写在最后的表(基础表 driving table ...

  10. SSL 握手过程

    SSL协议的握手过程 SSL 协议既用到了公钥加密技术又用到了对称加密技术,对称加密技术虽然比公钥加密技术的速度快,可是公钥加密技术提供了更好的身份认证技术.SSL 的握手协议非常有效的让客户和服务器 ...