[英]Can't use a Dictionary as an argument to a BuildProcessTemplate in VS2010?
I am trying to customize my build process template in VS2010. 我正在尝试自定义VS2010中的构建过程模板。 I have added an argument called "temp", of type "Dictionary < String, String >". 我添加了一个名为“ temp”的参数,类型为“ Dictionary <String,String>”。 I want the default value to be: "new Dictionary < String, String > ()" 我希望默认值为:“ new Dictionary <String,String>()”
When I enter the default value, VS complains: "Compiler error encountered process expression [...] '.' 当我输入默认值时,VS抱怨:“编译器遇到过程表达式[...]错误。” expected" 预期”
I've tried a few different variations on the default value (semicolon at the end; no semicolon at the end; String vs string; etc.), but haven't gotten it to work. 我尝试了一些默认值的不同变体(末尾为分号;末尾为无分号;字符串与字符串等),但还没有实现。 Any ideas? 有任何想法吗?
UPDATE: 更新:
I changed the default value to: 我将默认值更改为:
new Dictionary(Of String, String)
and that appears to work. 这似乎起作用。 However, I still cannot initialize the dictionary like so: 但是,我仍然无法像这样初始化字典:
new Dictionary(Of String, String) { {"cat", "dog"} }
Any ideas? 有任何想法吗?
Aha! 啊哈! Turns out the "from" syntax works: 原来“ from”语法有效:
New Dictionary(Of String, String) From {{"cat", "dog"}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.