自定义枚举作为C#中的应用程序设置类型? [英] Custom enum as application setting type in C#?
问题描述
如果C#中有枚举:
[Serializable]
public enum OperatingSystem
{
Windows,
Macintosh
}
对于我的应用程序,我使用应用程序设置,我可以在哪里选择哪一种类型的设置。我想当我选择浏览时,我可以选择我的枚举,或者键入完全限定路径来选择该枚举作为类型。
For my application I use the application settings, where I can select of which Type a setting should be. I thought when I select Browse, I could choose my enum or type the fully qualified path to select that enum as the Type.
编辑:
我将类型设置为我的枚举,但在Value(Windows,Macintosh应该是)只有Windows是可见的,我可以输入任何字符串。
I set the type to my Enum, but in the Value (where Windows, Macintosh should be) only Windows is visible and i'm able to enter any string.
推荐答案
我在VC#Express 2005中看到这个。浏览..选择类型对话框仅显示系统和Microsoft命名空间。但是,如果您将该类型的全称插入到所选类型文本框中,则应该接受它。
I see this in VC# Express 2005. The Browse.. "Select a Type" dialog shows only the System and Microsoft namespaces. However if you insert the full name of the type into the Selected Type textbox it should accept it.
这篇关于自定义枚举作为C#中的应用程序设置类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!