Skip to content

Instantly share code, notes, and snippets.

@yemrekeskin
Created February 12, 2014 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yemrekeskin/8955174 to your computer and use it in GitHub Desktop.
Save yemrekeskin/8955174 to your computer and use it in GitHub Desktop.
// 1 Way
public class Configuration
{
public string EndPoint
{
get { return ConfigurationManager.AppSettings["EndPoint"]; }
}
// other properties here//
}
// 2 WAy
public interface IConfiguration
{
string EndPoint { get; }
}
public class Configuration
: IConfiguration
{
public string EndPoint
{
get { return ConfigurationManager.AppSettings["EndPoint"]; }
}
// other properties here//
}
// 3 Way
public class Configuration
{
public string EndPoint { get; set; }
// other properties here//
}
public class ConfigurationLoader
{
public Configuration Load()
{
return new Configuration
{
EndPoint = ConfigurationManager.AppSettings["EndPoint"]
// other properties here//
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment