我在 C# .NET 3.5 - VS2010 中有以下代码,用于初始化自定义对象列表
我也需要在 Powershell 2.0 脚本中做同样的事情。
关于它的任何建议,不使用添加类型?
public static List<ReplaceForDeployFile> CreateReplaceList()
{
var list = new List<ReplaceForDeployFile>()
{
new ReplaceForDeployFile()
{
PathFile = "web.config",
ReplaceList =
new List<ItemReplaceForDeployFile>()
{
new ItemReplaceForDeployFile()
{
ReplaceType = "System.String",
ValueSource = @"value=""Value1""",
ValueForDES = @"value=""Value2""",
},
new ItemReplaceForDeployFile()
{
ReplaceType = "System.String",
ValueSource = @"customErrors mode=""On""",
ValueForDES = @"customErrors mode=""Off""",
},
},
},
};
return list;
}