Exemplo n.º 1
0
 /// <summary>
 /// Retrieves configuration section with a name that corresponds to <typeparamref name="T"/> short type name.
 /// </summary>
 /// <typeparam name="T">Configuration section Type that inherits <see cref="System.Configuration.ConfigurationSection"/>.</typeparam>
 /// <returns>
 /// The specified ConfigurationSection object of type <typeparamref name="T"/>,
 /// or null if the section does not exist.
 /// </returns>
 public static T GetSection <T>(this INConfiguration configuration) where T : ConfigurationSection
 {
     return(configuration.GetSection <T>(typeof(T).Name));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Retrieves a specified configuration section of type <typeparamref name="T"/> for the
 /// current configuration file set.
 /// </summary>
 /// <typeparam name="T">Configuration section Type that inherits <see cref="System.Configuration.ConfigurationSection"/>.</typeparam>
 /// <param name="configuration"></param>
 /// <param name="sectionName">The configuration section path and name.</param>
 /// <returns>
 /// The specified ConfigurationSection object of type <typeparamref name="T"/>,
 /// or null if the section does not exist.
 /// </returns>
 public static T GetSection <T>(this INConfiguration configuration, string sectionName) where T : ConfigurationSection
 {
     return(configuration.GetSection(sectionName) as T);
 }