本文整理汇总了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;
}
示例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;
}