public static string gencode_gettypes_fromnames(string name, List <string> names) { // build the type list CodeGen tl = new CodeGen(); const string ts = "types"; const string ns = "names"; tl.stmt("var " + ts + " = new List<Type>()"); tl.stmt("var " + ns + " = new string[] { \"" + string.Join("\",\"", names.ToArray()) + "\"}"); tl.line("foreach (var n in " + ns + ")"); tl.block_start(); tl.com("get type"); tl.stmt("var t = Type.GetType(\"GleanCommon.\"+n)"); tl.com("save it"); tl.stmt("if (t!=null) " + ts + ".Add(t)"); tl.block_end(); tl.stmt("return " + ts); tl.line(); // wrap function around it var code = TargetMap.GetMethod(GETTYPEFUNCTION + "_" + name, "static List<Type>", string.Empty, false, tl); code = h.retab(code); return(code); }