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     }  

 

 

posted @ 2013-04-24 16:07  若愚Shawn  阅读(265)  评论(0编辑  收藏  举报