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


C# Action.GetAttributes方法代码示例

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


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

示例1: ReturnsCorrectly

        public void ReturnsCorrectly()
        {
            string attributeName = "AttributeName";
            string attributeValue = "AttributeValue";

            Action<HtmlAttributeBuilder> attributeExpression = new Action<HtmlAttributeBuilder>( x => x.Attribute( attributeName, attributeValue ) );

            var result = attributeExpression.GetAttributes();

            Assert.IsNotNull( result );
            Assert.AreEqual( attributeValue, result[ attributeName ] );
        }
开发者ID:john-t-white,项目名称:Hex,代码行数:12,代码来源:ActionExtensions_GetAttributes.cs

示例2: RouteLink

 /// <summary>
 /// Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
 /// </summary>
 /// <param name="ajaxHelper">The AJAX helper.</param>
 /// <param name="linkText">The inner text of the anchor element.</param>
 /// <param name="routeName">The name of the route to use to obtain the form post URL.</param>
 /// <param name="routeValues">An object that contains the parameters for a route.</param>
 /// <param name="ajaxOptions">An object that provides options for the asynchronous request.</param>
 /// <param name="attributeExpression">An expression that contains the HTML attributes to set for the element.</param>
 /// <returns>An anchor element.</returns>
 /// <exception cref="T:System.ArgumentException">The <paramref name="linkText" /> parameter is null or empty.</exception>
 public static MvcHtmlString RouteLink( this AjaxHelper ajaxHelper, string linkText, string routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, Action<HtmlAttributeBuilder> attributeExpression )
 {
     return ajaxHelper.RouteLink( linkText, routeName, routeValues, ajaxOptions, attributeExpression.GetAttributes() );
 }
开发者ID:john-t-white,项目名称:Hex,代码行数:15,代码来源:LinkExtensions.cs

示例3: BeginRouteForm

 /// <summary>
 /// Writes an opening &lt;form&gt; tag to the response using the specified routing information.
 /// </summary>
 /// <param name="ajaxHelper">The AJAX helper.</param>
 /// <param name="routeName">The name of the route to use to obtain the form post URL.</param>
 /// <param name="routeValues">An object that contains the parameters for a route.</param>
 /// <param name="ajaxOptions">An object that provides options for the asynchronous request.</param>
 /// <param name="attributeExpression">An expression that contains the HTML attributes to set for the element.</param>
 /// <returns>An opening &lt;form&gt; tag.</returns>
 public static MvcForm BeginRouteForm( this AjaxHelper ajaxHelper, string routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, Action<HtmlAttributeBuilder> attributeExpression )
 {
     return ajaxHelper.BeginRouteForm( routeName, routeValues, ajaxOptions, attributeExpression.GetAttributes() );
 }
开发者ID:john-t-white,项目名称:Hex,代码行数:13,代码来源:FormExtensions.cs

示例4: ActionLink

 /// <summary>
 /// Returns an anchor element (a element) that contains the virtual path of the specified location.
 /// </summary>
 /// <param name="htmlHelper">The HTML helper instance that this method extends.</param>
 /// <param name="linkText">The inner text of the anchor element.</param>
 /// <param name="actionName">The name of the action.</param>
 /// <param name="controllerName">The name of the controller.</param>
 /// <param name="attributeExpression">An expression that contains the HTML attributes to set for the element.</param>
 /// <returns>An anchor element (a element).</returns>
 /// <exception cref="T:System.ArgumentException">The <paramref name="linkText" /> parameter is null or empty.</exception>
 public static MvcHtmlString ActionLink( this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, Action<HtmlAttributeBuilder> attributeExpression )
 {
     return htmlHelper.ActionLink( linkText, actionName, controllerName, null, attributeExpression.GetAttributes() );
 }
开发者ID:john-t-white,项目名称:Hex,代码行数:14,代码来源:LinkExtensions.cs

示例5: BeginForm

 /// <summary>
 /// Writes an opening &lt;form&gt; tag to the response. When the user submits the form, the request will be processed by an action method.
 /// </summary>
 /// <param name="htmlHelper">The HTML helper instance that this method extends.</param>
 /// <param name="actionName">The name of the action method.</param>
 /// <param name="controllerName">The name of the controller.</param>
 /// <param name="method">The HTTP method for processing the form, either GET or POST.</param>
 /// <param name="attributeExpression">An expression that contains the HTML attributes to set for the element.</param>
 /// <returns>An opening &lt;form&gt; tag.</returns>
 public static MvcForm BeginForm( this HtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method, Action<HtmlAttributeBuilder> attributeExpression )
 {
     return htmlHelper.BeginForm( actionName, controllerName, null, method, attributeExpression.GetAttributes() );
 }
开发者ID:john-t-white,项目名称:Hex,代码行数:13,代码来源:FormExtensions.cs

示例6: BeginActionLink

 /// <summary>
 /// Writes an opening &lt;a&gt; tag to the response.
 /// </summary>
 /// <param name="htmlHelper">The HTML helper instance that this method extends.</param>
 /// <param name="actionName">The name of the action.</param>
 /// <param name="controllerName">The name of the controller.</param>
 /// <param name="routeValues">An object that contains the parameters for a route.</param>
 /// <param name="attributeExpression">An expression that contains the HTML attributes to set for the element.</param>
 /// <returns>An opening &lt;a&gt; tag.</returns>
 public static MvcLink BeginActionLink( this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues, Action<HtmlAttributeBuilder> attributeExpression )
 {
     return htmlHelper.BeginActionLink( actionName, controllerName, null, null, null, routeValues, attributeExpression.GetAttributes() );
 }
开发者ID:john-t-white,项目名称:Hex,代码行数:13,代码来源:BeginLinkExtensions.cs

示例7: BeginRouteLink

 /// <summary>
 /// Writes an opening &lt;a&gt; tag to the response that contains the virtual path for the specified route values;
 /// when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
 /// </summary>
 /// <param name="ajaxHelper">The AJAX helper.</param>
 /// <param name="routeName">The name of the route to use to obtain the form post URL.</param>
 /// <param name="protocol">The protocol for the URL, such as "http" or "https".</param>
 /// <param name="hostName">The host name for the URL.</param>
 /// <param name="fragment">The URL fragment name (the anchor name).</param>
 /// <param name="routeValues">An object that contains the parameters for a route.</param>
 /// <param name="ajaxOptions">An object that provides options for the asynchronous request.</param>
 /// <param name="attributeExpression">An expression that contains the HTML attributes to set for the element.</param>
 /// <returns>An opening &lt;a&gt; tag.</returns>
 public static MvcLink BeginRouteLink( this AjaxHelper ajaxHelper, string routeName, string protocol, string hostName, string fragment, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, Action<HtmlAttributeBuilder> attributeExpression )
 {
     return ajaxHelper.BeginRouteLink( routeName, protocol, hostName, fragment, routeValues, ajaxOptions, attributeExpression.GetAttributes() );
 }
开发者ID:john-t-white,项目名称:Hex,代码行数:17,代码来源:BeginLinkExtensions.cs

示例8: Attributes

 /// <summary>
 /// Returns a string of HTML attributes with the specified values.
 /// </summary>
 /// <param name="htmlHelper">The HTML helper instance that this method extends.</param>
 /// <param name="attributeExpression">An expression that contains the HTML attributes to set for the element.</param>
 /// <returns>A string of HTML attributes with the specified values.</returns>
 public static MvcHtmlString Attributes( this HtmlHelper htmlHelper, Action<HtmlAttributeBuilder> attributeExpression )
 {
     return htmlHelper.Attributes( attributeExpression.GetAttributes() );
 }
开发者ID:john-t-white,项目名称:Hex,代码行数:10,代码来源:AttributesExtensions.cs


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