• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ParameterDescription类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ParameterDescription的典型用法代码示例。如果您正苦于以下问题:C# ParameterDescription类的具体用法?C# ParameterDescription怎么用?C# ParameterDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: SmartAttribute

 /// <summary>
 /// Initializes a new instance of the <see cref="SmartAttribute"/> class.
 /// </summary>
 /// <param name="identifier">The SMART identifier of the attribute.</param>
 /// <param name="name">The name of the attribute.</param>
 /// <param name="rawValueConversion">A delegate for converting the raw byte 
 /// array into a value (or null to use the attribute value).</param>
 /// <param name="sensorType">Type of the sensor or null if no sensor is to 
 /// be created.</param>
 /// <param name="sensorChannel">If there exists more than one attribute with 
 /// the same sensor channel and type, then a sensor is created only for the  
 /// first attribute.</param>
 /// <param name="defaultHiddenSensor">True to hide the sensor initially.</param>
 /// <param name="parameterDescriptions">Description for the parameters of the sensor 
 /// (or null).</param>
 public SmartAttribute(byte identifier, string name,
   RawValueConversion rawValueConversion, SensorType? sensorType, 
   int sensorChannel, bool defaultHiddenSensor = false,
   ParameterDescription[] parameterDescriptions = null) 
 {
   this.Identifier = identifier;
   this.Name = name;
   this.rawValueConversion = rawValueConversion;
   this.SensorType = sensorType;
   this.SensorChannel = sensorChannel;
   this.DefaultHiddenSensor = defaultHiddenSensor;
   this.ParameterDescriptions = parameterDescriptions;
 }
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:28,代码来源:SmartAttribute.cs


示例2: GenerateComplexTypeModelDescription

        private ModelDescription GenerateComplexTypeModelDescription(Type modelType)
        {
            ComplexTypeModelDescription complexModelDescription = new ComplexTypeModelDescription
            {
                Name = ModelNameHelper.GetModelName(modelType),
                ModelType = modelType,
                Documentation = CreateDefaultDocumentation(modelType)
            };

            GeneratedModels.Add(complexModelDescription.Name, complexModelDescription);
            bool hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null;
            PropertyInfo[] properties = modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
            foreach (PropertyInfo property in properties)
            {
                if (ShouldDisplayMember(property, hasDataContractAttribute))
                {
                    ParameterDescription propertyModel = new ParameterDescription
                    {
                        Name = GetMemberName(property, hasDataContractAttribute)
                    };

                    if (DocumentationProvider != null)
                    {
                        propertyModel.Documentation = DocumentationProvider.GetDocumentation(property);
                    }

                    GenerateAnnotations(property, propertyModel);
                    complexModelDescription.Properties.Add(propertyModel);
                    propertyModel.TypeDescription = GetOrCreateModelDescription(property.PropertyType);
                }
            }

            FieldInfo[] fields = modelType.GetFields(BindingFlags.Public | BindingFlags.Instance);
            foreach (FieldInfo field in fields)
            {
                if (ShouldDisplayMember(field, hasDataContractAttribute))
                {
                    ParameterDescription propertyModel = new ParameterDescription
                    {
                        Name = GetMemberName(field, hasDataContractAttribute)
                    };

                    if (DocumentationProvider != null)
                    {
                        propertyModel.Documentation = DocumentationProvider.GetDocumentation(field);
                    }

                    complexModelDescription.Properties.Add(propertyModel);
                    propertyModel.TypeDescription = GetOrCreateModelDescription(field.FieldType);
                }
            }

            return complexModelDescription;
        }
开发者ID:mdtahmidhossain,项目名称:Auxiliary,代码行数:54,代码来源:ModelDescriptionGenerator.cs


示例3: GenerateAnnotations

        private void GenerateAnnotations(MemberInfo property, ParameterDescription propertyModel)
        {
            List<ParameterAnnotation> annotations = new List<ParameterAnnotation>();

            IEnumerable<Attribute> attributes = property.GetCustomAttributes();
            foreach (Attribute attribute in attributes)
            {
                Func<object, string> textGenerator;
                if (AnnotationTextGenerator.TryGetValue(attribute.GetType(), out textGenerator))
                {
                    annotations.Add(
                        new ParameterAnnotation
                        {
                            AnnotationAttribute = attribute,
                            Documentation = textGenerator(attribute)
                        });
                }
            }

            // Rearrange the annotations
            annotations.Sort((x, y) =>
            {
                // Special-case RequiredAttribute so that it shows up on top
                if (x.AnnotationAttribute is RequiredAttribute)
                {
                    return -1;
                }
                if (y.AnnotationAttribute is RequiredAttribute)
                {
                    return 1;
                }

                // Sort the rest based on alphabetic order of the documentation
                return String.Compare(x.Documentation, y.Documentation, StringComparison.OrdinalIgnoreCase);
            });

            foreach (ParameterAnnotation annotation in annotations)
            {
                propertyModel.Annotations.Add(annotation);
            }
        }
开发者ID:mdtahmidhossain,项目名称:Auxiliary,代码行数:41,代码来源:ModelDescriptionGenerator.cs


示例4: AddParameterDescription

        private static ParameterDescription AddParameterDescription(HelpPageApiModel apiModel,
            ApiParameterDescription apiParameter, ModelDescription typeDescription)
        {
            ParameterDescription parameterDescription = new ParameterDescription
            {
                Name = apiParameter.Name,
                Documentation = apiParameter.Documentation,
                TypeDescription = typeDescription,
            };

            apiModel.UriParameters.Add(parameterDescription);
            return parameterDescription;
        }
开发者ID:atWinKAS,项目名称:AutoActions,代码行数:13,代码来源:HelpPageConfigurationExtensions.cs


示例5: EnterFunctionProcedureDivision

 /// <summary>Parent node: DECLARE FUNCTION</summary>
 /// <param name="context">PROCEDURE DIVISION</param>
 public override void EnterFunctionProcedureDivision(ProgramClassParser.FunctionProcedureDivisionContext context)
 {
     var header = (ProcedureDivisionHeader)context.ProcedureDivisionHeader().Symbol;
     if (header.UsingParameters != null && header.UsingParameters.Count > 0)
         DiagnosticUtils.AddError(header, "TCRFUN_DECLARATION_NO_USING");//TODO#249
     var declaration = (FunctionDeclarationHeader)CurrentNode.CodeElement;
     foreach(var parameter in declaration.Profile.InputParameters) {
         var paramNode = new ParameterDescription(parameter);
         paramNode.SymbolTable = CurrentNode.SymbolTable;
         CurrentNode.SymbolTable.AddVariable(paramNode);
     }
     foreach(var parameter in declaration.Profile.OutputParameters) {
         var paramNode = new ParameterDescription(parameter);
         paramNode.SymbolTable = CurrentNode.SymbolTable;
         CurrentNode.SymbolTable.AddVariable(paramNode);
     }
     foreach(var parameter in declaration.Profile.InoutParameters) {
         var paramNode = new ParameterDescription(parameter);
         paramNode.SymbolTable = CurrentNode.SymbolTable;
         CurrentNode.SymbolTable.AddVariable(paramNode);
     }
     if (declaration.Profile.ReturningParameter != null) {
         var paramNode = new ParameterDescription(declaration.Profile.ReturningParameter);
         paramNode.SymbolTable = CurrentNode.SymbolTable;
         CurrentNode.SymbolTable.AddVariable(paramNode);
     } else
     if (header.ReturningParameter != null) {
         // we might have a RETURNING parameter to convert, but only if there is neither
         // PICTURE nor TYPE clause for the returning parameter in the function declaration.
         // however, this is as syntax error.
         var pentry = new ParameterDescriptionEntry();
         var data = header.ReturningParameter.StorageArea as DataOrConditionStorageArea;
         if (data != null) pentry.DataName = new SymbolDefinition(data.SymbolReference.NameLiteral, data.SymbolReference.Type);
         // pentry.Picture will remain empty, we can't do anything about it
         pentry.DataType = DataType.Unknown;
         declaration.Profile.ReturningParameter = pentry;
     }
     Enter(new ProcedureDivision(header), context);
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:41,代码来源:CobolNodeBuilder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ParameterDescriptor类代码示例发布时间:2022-05-24
下一篇:
C# ParameterDefinition类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap