I have a Template base class and another subclasses of Template.
I have a tree structure of template object.
class Template
{
ArrayList child;
public virtual String Eval(Environment env)
{
String result="";
foreach (Template child in GetChild())
{
result=result+child.Eval(env).PadLeft(child.Eval(e nv).Length);
}
return result;
}
}
class SubTemplate :Template
{
public override String Eval(Environment env)
{
.......
String result="";
foreach (Template child in GetChild())
{
result=result+child.Eval(env).PadLeft(child.Eval(e nv).Length);
}
return result;
}
}
Eval is a polymorphic method.
After I build a tree of Template I call Eval on the root and this
return a string.
I use operator + to concatenate string but I would like know what is a
efficient method to concatenate string
in this specific case?