zoukankan      html  css  js  c++  java
  • FluentInterfaceDemo 草稿或者说笔记

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Collections;

    namespace FluentInterfaceDemo
    {
        class Program
        {
            static void Main(string[] args)
            {

                Fluent fluent = new Fluent();
                fluent.Money = 10000;
                Console.WriteLine(fluent.IsPass(f => f.Money));
                Console.WriteLine(fluent.CalcTax(f => f.Money).Money);

                Console.WriteLine(GetType<Fluent>(fluent));

                Console.Read();
            }


            static string GetType<TSource>(TSource t)
            {
                return t.GetType().ToString();

            }
        }

        class Fluent:IFluent
        {
            public int UserID { get; set; }
            public string Name { get; set; }
            public double Money { get; set; }
        }

        static class FluentExtent
        {
            public static bool IsPass(this IFluent fluent, Func<Fluent, double> func)
            {
                double m = func((Fluent)fluent);
                return double.Parse(m.ToString()) > 0;
            }

            public static Fluent CalcTax(this Fluent fluent, Func<Fluent, double> func)
            {
                fluent.Money = func(fluent) * 0.35;
                return fluent;
            }

        }

        class Tax
        {
            public double money { get; set; }
            public static double GetTax()
            {
                return 100;
            }
        }

        interface IFluent
        {

        }
    }

    参考资料:

    -------------------------------------------------------------------------------------------------------------------------------------------------
    数据库优化
    数据库教程
    数据库实战经验分享博客

    百度云下载

    评测


  • 相关阅读:
    修改FileUpload样式
    ASP.NET 中JSON 的序列化和反序列化
    C# 2.0中泛型编程初级入门
    50条经典爱情观
    (转贴)追MM与Java的23种设计模式
    猴子和香蕉的故事
    35岁前成功的12条黄金法则
    几个小故事
    java与C++的虚函数比较
    flask 源码解析:上下文(一) SUNNEVER
  • 原文地址:https://www.cnblogs.com/longle/p/2915630.html
Copyright © 2011-2022 走看看