Skip to content

Instantly share code, notes, and snippets.

@cprieto
Created May 15, 2010 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cprieto/402462 to your computer and use it in GitHub Desktop.
Save cprieto/402462 to your computer and use it in GitHub Desktop.
using System.Configuration;
namespace CustomConfigurationSection
{
public class SmtpSettings : ConfigurationSection
{
[ConfigurationProperty("Url", DefaultValue = "smtp.returngis.com", IsRequired = true)]
public string Url
{
get
{
return (string)this["Url"];
}
set
{
this["Url"] = value;
}
}
[ConfigurationProperty("Port", DefaultValue = 80)]
public int Port
{
get
{
return (int)this["Port"];
}
set
{
this["Port"] = value;
}
}
public static SmtpSettings GetSettings()
{
var settings = ConfigurationManager.GetSection("SmtpSettings") as SmtpSettings;
return settings;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment