-
-
Save huobazi/e4f4142ab0106927e96f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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