StringBuffer template = new StringBuffer("select * from XXX where id in ("); for (int i=0; i < idList.size(); i++) { template.append("?"); if (i < idList.size() - 1) { template.append(",") } } template.append(")"); 这短代码中的有些方法可能不是c#的,但大体思路是这样的。