我有纯粹的界面,如下面
public interface IPure
{
Array GetEmployee(int employeeId);
DataSet GetAllProducts();
List<string> GetAllSubCategoryNames();
double AverageSubTotalFromHeaders();
}
如何在运行时以编程方式添加合约属性?
答案 0 :(得分:4)
你做不到。属性是声明性的,而不是命令式的。
您可以在运行时,在配置服务主机时影响服务主机,但这只是将信息从配置文件移动到您的代码。
答案 1 :(得分:-1)
也许TypeDescriptor.AddAttributes可以帮到你。