当前位置: 首页>>代码示例>>C#>>正文


C# Func.DynamicInvoke方法代码示例

本文整理汇总了C#中Func.DynamicInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# Func.DynamicInvoke方法的具体用法?C# Func.DynamicInvoke怎么用?C# Func.DynamicInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Func的用法示例。


在下文中一共展示了Func.DynamicInvoke方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Header

 public MvcHtmlString Header(Func<dynamic, Object> markup)
 {
     var output = "<div class=\"panel-heading\">";
     output += markup.DynamicInvoke(ViewContext);
     output += "</div>";
     return MvcHtmlString.Create(output);
 }
开发者ID:renhammington,项目名称:UxFoundation,代码行数:7,代码来源:Panel.cs

示例2: JsMinify

 public static IHtmlString JsMinify(this HtmlHelper helper, Func<object, object> markup)
 {
     if (helper == null || markup == null)
     {
         return MvcHtmlString.Empty;
     }
     string sourceJs = (markup.DynamicInvoke(helper.ViewContext) ?? String.Empty).ToString();
     return !BundleTable.EnableOptimizations ?
         new MvcHtmlString(sourceJs) :
         new MvcHtmlString(SpaApp.MinifyJavaScript(sourceJs));
 }
开发者ID:vbilopav,项目名称:KendoCodeCamper,代码行数:11,代码来源:HtmlHelperExtensions.cs

示例3: JsMinify

        /// <summary>
        /// Jses the minify.
        /// </summary>
        /// <param name="helper">The helper.</param>
        /// <param name="markup">The markup.</param>
        /// <returns></returns>
        public static MvcHtmlString JsMinify(this HtmlHelper helper, Func<object, object> markup)
        {
            if (helper == null || markup == null)
            {
                return MvcHtmlString.Empty;
            }

            var sourceJs = (markup.DynamicInvoke(helper.ViewContext) ?? String.Empty).ToString();

            if (!IsJsMinify)
            {
                return new MvcHtmlString(sourceJs);
            }

            var minifier = new Minifier();

            var minifiedJs = minifier.MinifyJavaScript(sourceJs, new CodeSettings
            {
                EvalTreatment = EvalTreatment.MakeImmediateSafe,
                PreserveImportantComments = false
            });

            return new MvcHtmlString(minifiedJs);
        }
开发者ID:sandipghosh,项目名称:NJFairground,代码行数:30,代码来源:OptimizationExtensions.cs

示例4: CssMinify

        /// <summary>
        /// CSSs the minify.
        /// </summary>
        /// <param name="helper">The helper.</param>
        /// <param name="markup">The markup.</param>
        /// <returns></returns>
        public static MvcHtmlString CssMinify(this HtmlHelper helper, Func<object, object> markup)
        {
            if (helper == null || markup == null)
            {
                return MvcHtmlString.Empty;
            }

            var sourceCss = (markup.DynamicInvoke(helper.ViewContext) ?? String.Empty).ToString();

            if (!IsJsMinify)
            {
                return new MvcHtmlString(sourceCss);
            }

            var minifier = new Minifier();

            var minifiedCss = minifier.MinifyStyleSheet(sourceCss, new CssSettings
            {
                CommentMode = CssComment.None
            });

            return new MvcHtmlString(minifiedCss);
        }
开发者ID:sandipghosh,项目名称:NJFairground,代码行数:29,代码来源:OptimizationExtensions.cs

示例5: HandleFunction

        /// <summary>
        /// De-serializes and runs a compiled linq func expression.
        /// </summary>
        /// <param name="function">The function.</param>
        /// <param name="receivedMessage">The received message.</param>
        /// <param name="workerNotification">The worker notification.</param>
        private void HandleFunction(Func<IReceivedMessage<MessageExpression>, IWorkerNotification, object> function, IReceivedMessage<MessageExpression> receivedMessage, IWorkerNotification workerNotification)
        {
            var result = function.DynamicInvoke(receivedMessage, workerNotification);
            if (result == null) return;

            //if we have a connection, this is an rpc request
            var connection =
                receivedMessage.GetHeader(workerNotification.HeaderNames.StandardHeaders.RpcConnectionInfo);

            //if no connection, then this was not RPC
            if (connection == null) return;

            var timeOut =
                receivedMessage.GetHeader(workerNotification.HeaderNames.StandardHeaders.RpcTimeout).Timeout;

            //if we don't have an RPC queue for this queue, create one
            CreateRpcModuleIfNeeded(connection);

            //send the response
            var response =
                _rpcQueues[connection].Send(
                    result,
                    _rpcQueues[connection].CreateResponse(receivedMessage.MessageId, timeOut));

            if (response.HasError)
            {
                _log.ErrorException("Failed to send a response for message {0}", response.SendingException, receivedMessage.MessageId.Id.Value);
            }
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:35,代码来源:MessageMethodHandling.cs

示例6: parseData

        // Usage: parseData("{x:10,y:20}", MethodName);
        public static void parseData(string data, Func<Dictionary<string, string>, bool> func)
        {
            string[] d = data.Trim().Replace("\r", "").Replace("}", "\n}").Replace("{", "{\n").Replace("\n", "\n\n").Split('\n');
            var vals = new Dictionary<string, string>();

            for (int row = 0; row < d.Length; row++) {
                var line = d[row].Trim();
                if (line.Length == 0) continue;

                if (line.Substring(0, 1) == "}") {
                    func.DynamicInvoke(vals);
                    vals = new Dictionary<string, string>();
                } else {
                    var keyval = line.Split(new char[] { ':' }, 2);
                    string key = keyval[0].Trim().ToLower();
                    if (keyval.Length == 2 && !vals.ContainsKey(key)) vals.Add(key, keyval[1].Trim());
                }
            }
        }
开发者ID:QetriX,项目名称:Quly,代码行数:20,代码来源:Util.cs


注:本文中的Func.DynamicInvoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。