【发布时间】:2010-11-13 12:55:20
【问题描述】:
我在一个类中有一些简单的代码:
private ITemplate _content1 = null;
[TemplateContainer(typeof(ContentContainer))]
public ITemplate Content1
{
get
{ return _content1; }
set
{ _content1 = value; }
}
我需要大约 15 个这样的内容容器。我可以复制并粘贴此块 15 次并更改数字,但必须有更好的方法。谁能建议一种更清洁的方法来做到这一点?
【问题讨论】:
-
能否让 Content1 包含 ITemplate 项?
-
不清楚您要做什么 - 是否有机会为问题添加一些上下文?
标签: c# templates code-generation