假设我需要在刚刚从模板创建的扩展中存储任何数组.
我刚刚创建了新的VSIX项目,为其添加了VSPackage,然后添加了选项页面grid(DialogPage).然后我按照类似问题的答案的说明:DialogPage- 字符串数组没有持久化.
而且,为了演示目的,我们还添加了int[]数组和plain int以及自定义类型转换器.
// [standard attributes]
[ProvideOptionPage(typeof(OptionPageGrid),
"My Category", "My Grid Page", 0, 0, true)]
public sealed class FooBarVSPackage : Package
{
// standard code
}
public class OptionPageGrid : DialogPage
{
// [typical attributes]
[TypeConverter(typeof(StringArrayConverter))]
public string[] Foos
{ get; set; }
// [typical attributes]
[TypeConverter(typeof(CustomIntConverter))]
public int Bar
{ get; set; }
// [typical attributes]
[TypeConverter(typeof(IntArrayConverter))]
public int[] Bazes
{ get; …Run Code Online (Sandbox Code Playgroud)