Created
April 6, 2011 13:50
-
-
Save idavis/905671 to your computer and use it in GitHub Desktop.
Config
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
;config.ini | |
[Network] | |
DataFeed=http://mydomain.com/feed.xml | |
Port=68 | |
NextUpdate=3/23/2009 9:11:48 PM | |
You can load it: | |
var configurationSource = new IniConfigurationSource("config.ini"); | |
var datafeed = configurationSource.Sections["Network"].Get<string>("DataFeed"); | |
var datafeedUri = configurationSource.Sections["Network"].Get<Uri>("DataFeed"); | |
var nextUpdate = configurationSource.Sections["Network"].Get<DateTime>("NextUpdate"); | |
If you want to cut down on the typing, save the section: | |
var networkConfig = configurationSource.Sections["Network"]; | |
int port = networkConfig.Get<int>("Port"); | |
var longPort = networkConfig.Get<long>("Port"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment