Custom Application Setting

  • Thread starter =?ISO-8859-1?Q?Jos=E9_Manuel_Nieto?=
  • Start date
?

=?ISO-8859-1?Q?Jos=E9_Manuel_Nieto?=

Hello, I have a custom struct that I need to save with the rest of my
application settings.

The struct is as follows:

public struct ImageUploadOptions {
public Size ResampleSize;
public bool Resize;
}

How can I save an object of this type??
 
K

Kevin Spencer

Any type that can be serialized as XML can be used in Application Settings.
Is there something else specifically you need to know?

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
?

=?ISO-8859-1?Q?Jos=E9_Manuel_Nieto?=

Kevin Spencer escribió:
Any type that can be serialized as XML can be used in Application Settings.
Is there something else specifically you need to know?


I managed to do it! I was as easy as to create custom class as follows:

class ImageOptionsSetting : ApplicationSettingsBase {
[UserScopedSetting()]
[DefaultSettingValueAttribute(null)]
public MyType MyProperty {
...
...
}
}


Then I set the values for the custom properties and call Save() as I do
with Properties.Settings.Default.Save()

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top