如果在C#中有一个枚举:
[Serializable]
public enum OperatingSystem
{
Windows,
Macintosh
}
Run Code Online (Sandbox Code Playgroud)
对于我的应用程序,我使用应用程序设置,我可以在其中选择应该设置的类型.我想当我选择浏览时,我可以选择我的枚举或输入完全限定的路径来选择该枚举作为类型.
编辑:
我将类型设置为我的枚举,但在值(Windows,Macintosh应该是)中,只有Windows可见,我可以输入任何字符串.
我一直在努力将自定义类的自定义集合添加到我的winforms项目的应用程序设置中,我觉得我已经尝试了六种不同的方式,包括这种方式,这种方式,这种方式,这种方式但似乎没有任何工作......
目前代码符合,并且运行正常 - 任何地方都没有例外.编写他的保存功能,但在设置xml文件中没有创建条目(我有一些其他设置,它适用于所有这些,但这一个FYI).当它加载时,Properties.Settings.Default.LastSearches总是为空......有什么想法吗?
继承我目前的代码:
课程:
[Serializable]
public class LastSearch : ISerializable
{
public DateTime Date { get; set; }
public string Hour { get; set; }
public string Log { get; set; }
public string Command { get; set; }
public List<string> SelectedFilters { get; set; }
public List<string> SearchTerms { get; set; }
public List<string> HighlightedTerms { get; set; }
public List<string> ExcludedTerms { get; set; }
public …Run Code Online (Sandbox Code Playgroud) 我想在项目设置中使用我自己的枚举(从Visual studio,菜单项目,属性,选项卡设置).
我可以在那里选择很多默认类型,但在我的解决方案中甚至可以选择其他项目中的类型,但不能选择项目本身.
是否可以使用项目中的枚举类型作为设置的类型?