public class MyMeta
    {
        
public string MetaName { getset; }
        
public string Value { getset; }
    }

    
public class TestClass 
    {
        
public TestClass() { AColumn = new MyMeta(); }

        
public MyMeta AColumn { getset; }
    }
 

    
static class Program
    {
        
static void Main(string[] args)
        {
            
//这里要输出 "AColumn" 才行。 Enum 的枚举可能实现 Enum.One.ToString() 得到 "One" .
            Console.WriteLine(( new TestClass()).AColumn.MetaName );
        }
    }



说白了: 怎么做一个类, 实现 枚举的功能   最重要的两个: ToString()  和到 Int 的转化 ???

 

 

2015.1.23:

.net 3.5后,可以使用 lambda 日 expression 表达式实现,Mvc的 HtmlHelper 就是这样实现的。

 

相关文章:

  • 2022-02-05
  • 2021-12-18
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2021-06-17
  • 2021-10-09
猜你喜欢
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2021-07-06
  • 2021-07-14
相关资源
相似解决方案