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


C# ParameterType.ToString方法代码示例

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


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

示例1: ConvertParameterTypeToUnitType

        /// <summary>
        /// Returns the UnitType for the given 
        /// ParameterType (where possible).
        /// </summary>
        /// <param name="parameterType">The ParameterType 
        /// for which we need to know the UnitType</param>
        /// <exception cref="ArgumentException">Thrown if 
        /// it is not possible to convert the ParameterType 
        /// to a UnitType.</exception>
        public static UnitType ConvertParameterTypeToUnitType(
            ParameterType parameterType)
        {
            // The conversion will from the in-memory dictionary.

              //foreach( KeyValuePair<UnitType, ParameterType> kvp
              //  in BuildUnitTypeToParameterTypeMapping() )
              //{
              //  if( kvp.Value == parameterType )
              //  {
              //    return kvp.Key;
              //  }
              //}

              if (_map_parameter_type_to_unit_type.ContainsKey(
            parameterType))
              {
            return _map_parameter_type_to_unit_type[
              parameterType];
              }
              else
              {
            // If we made it this far, there's
            // no entry in the dictionary.

            throw new ArgumentException(
              "Cannot convert ParameterType '"
            + parameterType.ToString()
            + "' to a UnitType.");
              }
        }
开发者ID:nbright,项目名称:the_building_coder_samples,代码行数:40,代码来源:ParameterUnitConverter.cs

示例2: ParameterTypeName

 /// <summary>
 /// The ParameterType method returns a human-readable
 /// form of the ParameterType received as parameter.
 /// </summary>
 /// <param name="x">The ParameterType to be transformed to human-readable form.</param>
 /// <returns>A human-readable string form of the ParameterType received as parameter.</returns>
 public static string ParameterTypeName(ParameterType x)
 {
     switch(x)
       {
     case ParameterType.OPTIONAL:	return "Optional";
     case ParameterType.REQUIRED:	return "Required";
     default:  return "Unrecognized Parameter Type: "+x.ToString();
       }
 }
开发者ID:benamenco,项目名称:InfernoRDN,代码行数:15,代码来源:Parameter.cs

示例3: isValidParameter

 private bool isValidParameter(string name, ParameterType type, InterpolationType interp, int requestedSize, Parameter p)
 {
     if (p == null)
         return false;
     if (p.type != type)
     {
         UI.printWarning(UI.Module.API, "Parameter {0} requested as a {1} - declared as {2}", name, type.ToString().ToLower(), p.type.ToString().ToLower());
         return false;
     }
     if (p.interp != interp)
     {
         UI.printWarning(UI.Module.API, "Parameter {0} requested as a {1} - declared as {2}", name, interp.ToString().ToLower(), p.interp.ToString().ToLower());
         return false;
     }
     if (requestedSize > 0 && p.size() != requestedSize)
     {
         UI.printWarning(UI.Module.API, "Parameter {0} requires {1} {2} - declared with {3}", name, requestedSize, requestedSize == 1 ? "value" : "values", p.size());
         return false;
     }
     p.Checked = true;
     return true;
 }
开发者ID:rzel,项目名称:sunflowsharp,代码行数:22,代码来源:ParameterList.cs

示例4: GetValueByType

 public string GetValueByType(ParameterType type)
 {
     return Parameters.FirstOrDefault(x => x.Definition == type.ToString()).Value;
 }
开发者ID:hendrikdelarey,项目名称:appcampus,代码行数:4,代码来源:WidgetModel.cs

示例5: GetParameterAsString

 private string GetParameterAsString(ParameterType param)
 {
     switch (param)
       {
     case ParameterType.String:
       return " - text string";
     case ParameterType.Type:
       return " - type";
     case ParameterType.VariableReference:
       return " - reference to another parameter in the template";
       }
       return param.ToString();
 }
开发者ID:dmimat,项目名称:RsDocGenerator,代码行数:13,代码来源:RsDocExportMacros.cs


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