public static Create ( ITranslationUnit type, ITranslationUnit names, ITranslationUnit expressions = null, bool shouldRenderDeclarationKeyword = true ) : |
||
type | ITranslationUnit | |
names | ITranslationUnit | |
expressions | ITranslationUnit | |
shouldRenderDeclarationKeyword | bool | |
리턴 |
public static VariableDeclarationTranslationUnit Create(
ITranslationUnit type, ITranslationUnit[] names, ITranslationUnit[] expressions = null,
bool shouldRenderDeclarationKeyword = true)
{
if (names == null)
{
throw new ArgumentNullException(nameof(names));
}
if (names.Length == 0)
{
throw new ArgumentException(nameof(names), "At least one name needed!");
}
if (expressions != null && expressions.Length != names.Length)
{
throw new ArgumentException(nameof(expressions), "Number of expressions should match number of names!");
}
return new VariableDeclarationTranslationUnit()
{
names = names,
type = type,
expressions = expressions,
shouldRenderDeclarationKeyword = shouldRenderDeclarationKeyword
};
}
/// <summary> /// Initializes a new instance of the <see cref="ArgumentDefinitionTranslationUnit"/> class. /// </summary> /// <param name="typeName"></param> /// <param name="name"></param> protected ArgumentDefinitionTranslationUnit(ITranslationUnit typeName, ITranslationUnit name) { this.variableDeclaration = VariableDeclarationTranslationUnit.Create(typeName, name, null, false); }