zoukankan      html  css  js  c++  java
  • 自定义Func方法支持out,ref参数

    默认的Func不支持Out,ref类型的参数,所以需要自定义个delegate func来满足需求。具体代码如下

    public delegate TResult FuncEX<T1, T2, T3, T4, T5, out TResult>(T1 obj1, T2 obj2, out T3 obj3, out T4 obj4, ref T5 obj5);
        public void ContractFileDownload_DownloadPurOrder()
        {
            decimal seqID = Request["ID"].ExToDecimal();
            decimal supplierID = Request["SupplierID"].ExToDecimal();
    
            string msg = "";
            string fileUrl, filePath;
           HttpContext MainthreadContext = HttpContext.Current;
            FuncEX<decimal, decimal, string, string, HttpContext, string> dl = PurOrder;
            dl.BeginInvoke(seqID, supplierID, out fileUrl, out filePath, ref MainthreadContext, TakesAWhileCompleted, dl);
    
        }
    
        public string PurOrder(decimal seqID, decimal supplierID, out string fileUrl, out string filePath,ref HttpContext context)
        {
            using (var bllProvider = BLLProviders.Create())
            {
                return bllProvider.Cas_invest_contractBLL.downLoad_PurOrder(seqID, supplierID, out fileUrl, out filePath,ref context);
            }
        }
    
        public void TakesAWhileCompleted(IAsyncResult ar)
        {
            if (ar != null)
            {
                string fileUrl, filePath;
                HttpContext currentContext=null;
                FuncEX<decimal, decimal, string, string, HttpContext, string> dl = (FuncEX<decimal, decimal, string, string, HttpContext, string>)ar.AsyncState;
                string msg = dl.EndInvoke(out fileUrl, out filePath, ref currentContext, ar);
                
            }
        }
  • 相关阅读:
    解决rsyslog 断电或者被kill 重发问题
    perl dbi 测试 mysql wait_timeout
    PERL DBI 自动重连问题
    elasticsearch 重启后,需要的操作
    Filter Conditions 过滤条件
    rsyslog Properties 属性:
    nginx对比haproxy 的反向代理
    Templates 模板:
    1.Basic Structure
    beego的orm ,用的数据库sqlite3
  • 原文地址:https://www.cnblogs.com/colder/p/11790809.html
Copyright © 2011-2022 走看看