zoukankan      html  css  js  c++  java
  • List<Table> 的委托

    项目中要用到类型(多种型号查找),所以我打算用委托;返回的是List<Table> .

    string series = Request.QueryString["series"]; //接收不同型号的产品系列


    if (!string.IsNullOrEmpty(series))
    {
    BLL.Productsdelegate getProductsType = new BLL.Productsdelegate();
    DataList1.DataSource=getProductsType.GetProducts(series,getProductsType.GetType18);  // 返回List<Table> 绑定到控件上
    DataList1.DataBind();
    }

    -------------------------------------------------

    public delegate List<Products> GetProductType(string type);   //声明 委托类型是List<Table>

    public class Productsdelegate
    {
    public List<Products> GetProducts(string type, GetProductType ProductsType)   // 方法返回的类型是List<Table>
    {
    return ProductsType(type);
    }

    public List<Products> GetType18(string type)
    {
    BLL.BLL_Products bll = new BLL_Products();
    return bll.GetList().Where(T=>T.Type==type.ToUpper()).ToList();   //查询返回 List<Table>
    }
    public void GetType20(string type)
    {
    Console.Write("j20"); // 测试用的; 
    // return type;
    }

    }

  • 相关阅读:
    spring boot @value 使用
    mac Navicat premium 链接oracle
    List sort 排序
    mac 配置jdk+maven环境变量
    mybatis 根据主键批量insert或update
    git 常用命令
    SpringBoot整合Activiti案例
    Activiti网关-并行网关
    Activiti网关-包含网关
    Activiti网关-排他网关
  • 原文地址:https://www.cnblogs.com/liuming8208/p/2283882.html
Copyright © 2011-2022 走看看