使用带有复杂类型设置 [英] Using Settings with Complex Types

查看:105
本文介绍了使用带有复杂类型设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的.NET项目设置类。我注意到只有某些类型可被用作类型在设置类的单个属性编辑器。如果我想有那是从我的代码枚举或者例如泛型集合的属性?我将如何实现呢?

I am using the Settings class in my .NET project. I notice in the editor that only certain types are available to be used as types for the individual properties in the Settings class. What if I wanted to have a property that was an enumeration from my code or a generic collection for instance? How would I implement that?

我猜,我可以使用部分类机制(因为设置已被定义为部分类)做在一个单独的文件但我想看看是否有人与同意,如果有可能的方式在编辑器中做到这一点。

I'm guessing that I can do it in a separate file using the partial class mechanism (since Settings is already defined as a partial class) but I want to see if anyone agrees with that and if there may be a way to do it within the editor.

推荐答案

创建一个新的设置文件中添加所选择的一个复杂的/用户定义的类型。
这是一个如何做一个枚举。

Create a new "Settings" file to add a complex/user-defined type of choice. Here is a how-to for a Enum.

第1步即可。创建一个设置文件

Step 1. Create a Settings file

第2步即可。浏览型

第3步即可。选择类型(Namespace.TypeName)

Step 3. Select type (Namespace.TypeName)

第四步即可。ただ - 完成

Step 4. Ta da - Done

这篇关于使用带有复杂类型设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆