Tom
Tom

Reputation: 1290

How do I store a custom class from within the same assembly in application settings?

I have a very simple class

public class Preferences
{
    public bool RepeatInfinite { get; set; }
    public int RepeatCount { get; set; }
}

If I put this class in another assembly it shows up in the Settings tab when you browse for the type. If I however put this class in the same assembly as the running program, I can't see it or browse for it. What's going on here?

Upvotes: 0

Views: 158

Answers (1)

JaredPar
JaredPar

Reputation: 754585

I've had the same problem and it's quite annoying. To work around it I do the following.

  • Create the setting and type it to Object
  • Open the settings file in notepad
  • Change the type to the name of the type in the same assembly (fully qualified name)
  • Reopen the designer.
  • Make an innocuous change, hit save and the C# file gets regenerated with your type.

Upvotes: 2

Related Questions