I've looked around and nothing has helped so far.
I currently have this code:
namespace InstaShot
{
[Serializable]
public class Hotkey
{
public uint Modifier { get; private set; }
public int Key { get; private set; }
public Hotkey(uint modifier, int key)
{
this.Modifier = modifier;
this.Key = key;
}
}
}
Yet whenever I try and create a setting in my application settings, I get:
Type 'InstaShot.Hotkey' is not defined.
When clearly it is... It works for other classes inside the same namespace, just not that one... it's really annoying me now.
Though the question author has likely moved on it is worth posting an answer in case others come across the same issue.
First let me clarify the question since comments on the question indicate there was some ambiguity. The OP is not asking about custom configuration sections. Rather, the question is about using standard settings--the settings pane you get when you open the Settings tab on the project properties in Visual Studio, as shown:
As to the answer, you must add a default constructor, i.e. a no-argument constructor where you assign default values. Once I did that, I was able to specify the type to get the result shown in the figure above. (Note that if your custom type is in the same assembly as your settings, it will not appear in the list of available types when you open the dropdown in the settings designer, nor--once you select browse
--will it appear in that list either, but at that point you can type in the fully qualified name.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With