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


C# ParameterList.GetParameter方法代码示例

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


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

示例1: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            var metaTags = new List<XElement>();

            string contentType = parameters.GetParameter<string>("ContentType");
            string designer = parameters.GetParameter<string>("Designer");
            bool showGenerator = parameters.GetParameter<bool>("ShowGenerator");

            if (!string.IsNullOrWhiteSpace(contentType))
            {
                metaTags.Add(new XElement(Namespaces.Xhtml + "meta",
                    new XAttribute("http-equiv", "Content-Type"),
                    new XAttribute("content", contentType)));
            }

            if (!string.IsNullOrWhiteSpace(designer))
            {
                metaTags.Add(new XElement(Namespaces.Xhtml + "meta",
                    new XAttribute("name", "Designer"),
                    new XAttribute("content", designer)));
            }

            if (showGenerator)
            {
                metaTags.Add(new XElement(Namespaces.Xhtml + "meta",
                    new XAttribute("name", "Generator"),
                    new XAttribute("content", "Composite C1 CMS - Free Open Source from http://composite.net/")));
            }

            return metaTags;
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:31,代码来源:CommonMetaTagsFunction.cs

示例2: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            IEnumerable<string> strings = parameters.GetParameter<IEnumerable<string>>("Strings");
            string separator = parameters.GetParameter<string>("Separator");

            return string.Join(separator, strings.ToArray());
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:7,代码来源:Join.cs

示例3: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            IComparable valueA = parameters.GetParameter<IComparable>("ValueA");
            IComparable valueB = parameters.GetParameter<IComparable>("ValueB");

            return valueA.CompareTo(valueB);
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:7,代码来源:IsLessThanFunction.cs

示例4: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            IEnumerable elements = parameters.GetParameter<IEnumerable>("Elements");
            string keyPropertyName = parameters.GetParameter<string>("KeyPropertyName");
            string valuePropertyName = parameters.GetParameter<string>("ValuePropertyName");

            Dictionary<string, string> resultDictionary = new Dictionary<string, string>();

            PropertyInfo keyPropertyInfo = null;
            PropertyInfo valuePropertyInfo = null;
            foreach (object element in elements)
            {
                if (keyPropertyInfo == null)
                {
                    keyPropertyInfo = element.GetType().GetProperty(keyPropertyName);
                }

                if (valuePropertyInfo == null)
                {
                    valuePropertyInfo = element.GetType().GetProperty(valuePropertyName);
                }

                string keyValue = keyPropertyInfo.GetValue(element, null).ToString();
                string valueValue = valuePropertyInfo.GetValue(element, null).ToString();

                resultDictionary.Add(keyValue, valueValue);
            }

            return resultDictionary;
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:30,代码来源:EnumerableToDictionary.cs

示例5: GetWidgetMarkup

        /// <exclude />
        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)
        {
            XElement element = base.BuildBasicWidgetMarkup("InlineXhtmlEditor", "Xhtml", label, help, bindingSourceName);
            element.Add(new XAttribute("ClassConfigurationName", parameters.GetParameter<string>(ClassConfigurationNameParameterName)));

            var pageId = parameters.GetParameter<Guid>(PreviewPageIdParameterName);
            var templateId = parameters.GetParameter<Guid>(PreviewTemplateIdParameterName);
            string placeholderName = parameters.GetParameter<string>(PreviewPlaceholderParameterName);

            if (pageId != Guid.Empty)
            {
                element.Add(new XAttribute("PreviewPageId", pageId));
            }

            if (templateId != Guid.Empty)
            {
                element.Add(new XAttribute("PreviewTemplateId", templateId));
            }

            if (!string.IsNullOrEmpty(placeholderName))
            {
                element.Add(new XAttribute("PreviewPlaceholder", placeholderName));
            }

            return element;
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:27,代码来源:VisualXhtmlEditorWidgetFuntion.cs

示例6: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            object valueA = parameters.GetParameter<object>("ValueA");
            object valueB = parameters.GetParameter<object>("ValueB");

            return valueA.Equals(valueB);
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:7,代码来源:AreEqualFunction.cs

示例7: Execute

		public override object Execute(ParameterList parameters, FunctionContextContainer context)
		{
			var result = new List<FormEmail>();
			result.AddRange(parameters.GetParameter<IEnumerable<FormEmail>>("EmailA"));
			result.AddRange(parameters.GetParameter<IEnumerable<FormEmail>>("EmailB"));
			return result;
		}
开发者ID:JustAndrei,项目名称:C1-Packages,代码行数:7,代码来源:JoinEmailsFunction.cs

示例8: Execute

 public override object Execute(ParameterList parameters, FunctionContextContainer context)
 {
     return new TitleControl {
         PrefixToRemove = parameters.GetParameter<string>("PrefixToRemove"),
         PostfixToRemove = parameters.GetParameter<string>("PostfixToRemove")
     };
 }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:7,代码来源:HtmlTitleValueFunction.cs

示例9: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            string stringA = parameters.GetParameter<string>("StringA");
            string stringB = parameters.GetParameter<string>("StringB");
            string separator = parameters.GetParameter<string>("Separator");

            return stringA + separator + stringB;
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:8,代码来源:JoinTwo.cs

示例10: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            if (HttpContext.Current != null && HttpContext.Current.Request != null)
              {
              HttpContext.Current.Session[parameters.GetParameter<string>("VariableName")] = parameters.GetParameter<string>("Value");
              }

              return null;
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:9,代码来源:SetSessionVariableFunction.cs

示例11: GetWidgetMarkup

        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)
        {
            XElement boolSelectorMarkup = base.BuildBasicWidgetMarkup("BoolSelector", "IsTrue", label, help, bindingSourceName);

            boolSelectorMarkup.Add(new XAttribute("TrueLabel", parameters.GetParameter<string>(BoolSelectorWidgetFuntion.TrueLabelParameterName)));
            boolSelectorMarkup.Add(new XAttribute("FalseLabel", parameters.GetParameter<string>(BoolSelectorWidgetFuntion.FalseLabelParameterName)));

            return boolSelectorMarkup;
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:9,代码来源:BoolSelectorWidgetFuntion.cs

示例12: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            string stringToSplit = parameters.GetParameter<string>("String");
            string[] separator = new string[] { parameters.GetParameter<string>("Separator") };

            var resultArray = stringToSplit.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            return new List<string>(resultArray);
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:9,代码来源:Split.cs

示例13: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            if (HttpContext.Current != null && HttpContext.Current.Request != null)
            {
                string result = HttpContext.Current.Request.Form[parameters.GetParameter<string>("ParameterName")];

                return XmlConvert.ToDateTime(result, XmlDateTimeSerializationMode.Local);
            }

            return parameters.GetParameter<DateTime>("FallbackValue");
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:11,代码来源:FormPostXmlFormattedDateTimeValueFunction.cs

示例14: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            if (HttpContext.Current != null && HttpContext.Current.Request != null)
            {
                string result = HttpContext.Current.Request.Form[parameters.GetParameter<string>("ParameterName")];

                if (result != null) return decimal.Parse(result);
            }

            return parameters.GetParameter<decimal>("FallbackValue");
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:11,代码来源:FormPostDecimalValueFunction.cs

示例15: Execute

        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            if (HttpContext.Current != null && HttpContext.Current.Request != null)
            {
                string result = HttpContext.Current.Request.QueryString[parameters.GetParameter<string>("ParameterName")];

                if (result != null) return new Guid(result);
            }

            return parameters.GetParameter<Guid>("FallbackValue");
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:11,代码来源:QueryStringGuidValueFunction.cs


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