using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Tango.CodeGeneration { /// /// Represents a method code object. /// /// public class Method : CodeObject { /// /// Gets or sets the method name. /// public String Name { get; set; } /// /// Gets or sets the method arguments. /// public List> Arguments { get; set; } /// /// Gets or sets the method return type. /// public String ReturnType { get; set; } /// /// Gets or sets the method modifier. /// public MethodModifier MethodModifier { get; set; } /// /// Gets or sets the method content. /// public String Content { get; set; } /// /// Initializes a new instance of the class. /// public Method() : base() { Name = "MyMethod"; Arguments = new List>(); ReturnType = "void"; } /// /// Initializes a new instance of the class. /// /// The name. /// Type of the return. /// The content. /// The method modifier. public Method(String name, String returnType, String content, MethodModifier methodModifier = Tango.CodeGeneration.MethodModifier.None) : this() { Name = name; ReturnType = returnType; Content = content; MethodModifier = methodModifier; } /// /// Gets the arguments string. /// /// public String GetArgumentsString() { if (Arguments.Count > 0) { return String.Join(", ", Arguments.Select(x => x.Key + " " + x.Value).ToList()); } else { return String.Empty; } } } }