protected override bool InitializeTemplates() { Templates.Clear(); var codeTemplate1 = new ParametricComposer("<@", "@>"); codeTemplate1.SetTemplateText( @"public Multivector() { } public Multivector(params double[] coefs) { int i = 0; foreach (var coef in coefs.Take(<@gadim@>)) Coef[i++] = coef; } public Multivector(IEnumerable<double> coefs) { int i = 0; foreach (var coef in coefs.Take(<@gadim@>)) Coef[i++] = coef; } " ); Templates.Add("multivector", codeTemplate1); return(true); }
/// <summary> /// Substitutes the given items into the text replacing any text block in the form |{n}| where /// n is the order of the given item. Functionally similar to String.Format(). /// </summary> /// <param name="text"></param> /// <param name="items"></param> /// <returns></returns> public string Substitute(string text, params object[] items) { _substituteComposer.SetTemplateText(text); return(_substituteComposer.GenerateUsing(items)); }