相关疑难解决方法(0)

使用DialogPage将数组存储在选项中

假设我需要在刚刚从模板创建的扩展中存储任何数组.

我刚刚创建了新的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)

visual-studio-sdk vsix visual-studio-2015

8
推荐指数
1
解决办法
514
查看次数