C#語言實現類似這樣的效果: 3.grams.flour
來源:程序員人生 發布時間:2015-03-04 08:04:25 閱讀次數:2855次
C#語言實現類似這樣的效果: 3.grams.flour
參考 Martin Fowler《領域特定語言》第387頁的代碼,我做以下實現。
3.chi(), 3尺 轉換為國際標準單位制米。
namespace int_ext
{
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine( 3.chi() ); // output 0.999
}
}
public static class int_e
{
public static double chi(this int arg)
{
return arg * 0.333;
}
}
}
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈