zoukankan      html  css  js  c++  java
  • 通过定义任务委托的方法处理 action

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    
    namespace BZ.Web.QiYe.Handler
    {
        /// <summary>
        /// Handler1 的摘要说明
        /// </summary>
        public class Handler1 : IHttpHandler
        {
    
            private delegate void task(); //定义任务委托
    
            public void ProcessRequest(HttpContext context)
            {
                context.Response.Clear();
                //委托事件
                //任务数组
                task[] tasks =
                {
                    // Method();存放方法名
    
                };
                string sAction = (string)context.Request["action"];
    
                foreach (task item in tasks)
                {
                    if (item.Method.Name.Equals(sAction))
                    {
                        item.Invoke();
                        break;
                    }
                }
            }
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }
    

      

  • 相关阅读:
    redis改配置
    redis主从复制
    nginx做维护页面
    go_http
    DRF源码-views.py
    DRF教程10-关系字段
    语言特性
    DRF源码-fields.py
    python_@classmethod
    HTML5:定位
  • 原文地址:https://www.cnblogs.com/banyan-rong/p/3854028.html
Copyright © 2011-2022 走看看