C#工具代码

Posted 博观约取 厚积薄发

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C#工具代码相关的知识,希望对你有一定的参考价值。

  1. 反射获取当前请求参数
    var httpContext_Current = System.Type.GetType("System.Web.HttpContext, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
    .GetProperty("Current").GetValue(null, null)
    var request = prop.GetType().GetProperty("Request").GetValue(httpContext_Current, null);
    var parameter = rq.GetType().GetMethod("get_Item").Invoke(rq, new object[] { "admin" });
    用途:用于#DEBUG时,设置一些调试数据

以上是关于C#工具代码的主要内容,如果未能解决你的问题,请参考以下文章