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     }  
  • 相关阅读:
    RSA 与 DSA
    atlassian
    Cygwin
    windows下编写的Shell脚本在Linux下运行错误的解决方法
    NSKeyValueObserving(KVO)
    UIBezierPath 的使用介绍
    Objective
    Objective-C 内存管理原则
    Mac OSX 快捷键&命令行总览
    浅析Objective-C字面量
  • 原文地址:https://www.cnblogs.com/shawnzxx/p/3040404.html
Copyright © 2011-2022 走看看