zoukankan      html  css  js  c++  java
  • 接口多适用类(泛型)


        public class IC
        {
            public int Id { get; set; }
        }
        public class  test
        {
            public Bll bll=new Bll();
            public void YouMath()
            {
                var model = new IC();
                bll.Add(model);
            }

        }

        public class Bll : IBll
        {
            public void Delete(int id)
            {
                throw new NotImplementedException();
            }

            public void Add(IC model)
            {
                throw new NotImplementedException();
            }

            public void Update(IC model)
            {
                throw new NotImplementedException();
            }

            public void Get(int id)
            {
                throw new NotImplementedException();
            }

            public void GetModelsByPage(int currPage, int pageSize)
            {
                throw new NotImplementedException();
            }

            public void DoSomeThin()
            {
                throw new NotImplementedException();
            }
        }
        public interface IBll : IBaseBll<IC>
        {
            void DoSomeThin();
        }

        public interface IBaseBll<in T> where T : new()
        {
            void Delete(int id);
            void Add(T model);
            void Update(T model);
            void Get(int id);
            void GetModelsByPage(int currPage, int pageSize);
        }

  • 相关阅读:
    Paxos算法简单陈述
    二段式提交和三段式提交
    Guava包学习--Hash
    JedisPool无法获得资源问题
    有料面试题之--Object里面的方法
    Spring常用jar包的功能
    线上日志分析与其他一些脚本
    Flutter-漸變色按鈕
    Flutter-自定義圖標或者選擇框
    Flutter-自定義圖片圖標
  • 原文地址:https://www.cnblogs.com/change4now/p/4856657.html
Copyright © 2011-2022 走看看