zoukankan      html  css  js  c++  java
  • Export class type

    C# API有这样的功能:

    View Code
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 
     6 namespace ConsoleApplication5
     7 {
     8     abstract class Person
     9     {
    10         private string _name;
    11         public string Name
    12         {
    13             get { return _name; }
    14         }
    15         
    16     }
    17     class Empoyee : Person
    18     {
    19        
    20 
    21     }
    22     class Janitor : Person
    23     {
    24       
    25     }
    26     class Program
    27     {
    28         static void Main(string[] args)
    29         {
    30             var people = new List<Person>();
    31             people.Add(new Empoyee());
    32             people.Add(new Janitor());
    33             foreach (var item in people)
    34             {
    35                 Console.WriteLine("Type {0}", item.GetType().Name);
    36             }
    37             Console.ReadKey();
    38         }
    39     }
    40 }

    但是我们提倡这样做:The text用来update用户应该来自code本身,而不是来自什么build in framework。为了自由

    View Code

    比如Localization:

    View Code
    1 class Janitor : Person
    2     {
    3      。。。
    4         public override string TypeOfData
    5         {
    6             get {return Internationlization.Translate(string Janitor);}  
    7         } 
    8      。。。
    9     }  
  • 相关阅读:
    Go语言基础之包
    Go语言基础之结构体
    Go语言基础之函数
    Go语言基础之map
    Go语言基础之指针
    Go语言基础之切片
    Go语言基础之数组
    02-Spring配置文件加载
    01-Spring概述(总览)
    将博客搬至CSDN
  • 原文地址:https://www.cnblogs.com/shawnzxx/p/3040404.html
Copyright © 2011-2022 走看看