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


C# Class.AddNode方法代码示例

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


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

示例1: TryAddMemberAsProperty

    /// <summary>
    /// Tries to add member as a property.
    /// </summary>
    /// <param name="contractClass">The contract class.</param>
    /// <param name="member">The member.</param>
    /// <returns>
    ///   <c>true</c> if the member was a property and added; otherwise <c>false</c>
    /// </returns>
    private bool TryAddMemberAsProperty(Class contractClass, Member member)
    {
      Contract.Requires(contractClass != null, "contractClass is null.");
      Contract.Requires(member != null, "member is null.");

      var interfaceProperty = member as Property;
      if (interfaceProperty == null)
      {
        return false;
      }

      var contractProperty = new Property();
      this.SetupMemberDeclaration(contractProperty, interfaceProperty);
      contractProperty.AddNode(this.CreateGetter(interfaceProperty));
      contractProperty.AddNode(CreateSetter(interfaceProperty));

      contractClass.CloneDocComment(interfaceProperty);
      contractClass.AddNode(contractProperty);
      return true;
    }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:28,代码来源:ContractClassBuilder.cs

示例2: TryAddMemberAsMethod

    /// <summary>
    /// Tries to add member as a method.
    /// </summary>
    /// <param name="contractClass">The contract class.</param>
    /// <param name="member">The member.</param>
    /// <returns>
    ///   <c>true</c> if the member was a method and added; otherwise <c>false</c>
    /// </returns>
    private bool TryAddMemberAsMethod(Class contractClass, Member member)
    {
      Contract.Requires(contractClass != null, "contractClass is null.");
      Contract.Requires(member != null, "member is null.");

      var interfaceMethod = member as Method;
      if (interfaceMethod == null)
      {
        return false;
      }

      var method = new Method();
      this.SetupMemberDeclaration(method, interfaceMethod);
      if (string.IsNullOrEmpty(interfaceMethod.MemberType) || interfaceMethod.MemberType == "void")
      {
        method.MethodType = MethodTypeEnum.Void;
      }
      else
      {
        method.MethodType = MethodTypeEnum.Function;
        var typeReferenceExp = interfaceMethod.MemberTypeReference;
        if (typeReferenceExp != null)
        {
          this.AddDefaultReturn(method, typeReferenceExp);
        }
      }

      method.AddToDoComment();
      method.CopyParameters(interfaceMethod);

      contractClass.CloneDocComment(interfaceMethod);
      contractClass.AddNode(method);
      return true;
    }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:42,代码来源:ContractClassBuilder.cs


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