Skip to content

Instantly share code, notes, and snippets.

@inwenis
Created May 14, 2018 21:19
Show Gist options
  • Save inwenis/36626ce8260d6d5e2cc78ade15a5743c to your computer and use it in GitHub Desktop.
Save inwenis/36626ce8260d6d5e2cc78ade15a5743c to your computer and use it in GitHub Desktop.
what is this interface for?
internal interface IAppSettingsReader
{
GasPeriodDto GetGasPeriodFromConfig();
bool IsHourly();
BalanceOverviewFilterDto GetFiltersFromConfig();
}
class AppSettingsReader : IAppSettingsReader
{
public GasPeriodDto GetGasPeriodFromConfig()
{
int gasPeriod;
int.TryParse(ConfigurationManager.AppSettings["GasPeriod"], out gasPeriod);
return GasPeriodDto.All.First(p => p.Id == gasPeriod);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment