Skip to content

Commit 959ca26

Browse files
authored
Apply suggestions from code review
1 parent f5ded46 commit 959ca26

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

aspnetcore/fundamentals/configuration/options.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,19 @@ In the preceding code, by default, changes to the JSON configuration file after
108108

109109
<a name="named"></a>
110110

111-
## Specify a custom key name for a configuration property using ConfigurationKeyName
111+
## Specify a custom key name for a configuration property using `ConfigurationKeyName`
112112

113-
By default, the property names of the Options class are used as the key name in the configuration source. For example, if the property name is `Title`, the key name in the configuration is `Title` as well.
113+
By default, the property names of the options class are used as the key name in the configuration source. If the property name is `Title`, the key name in the configuration is `Title` as well.
114114

115-
When the names differentiate, you can use [`ConfigurationKeyName` attribute](xref:Microsoft.Extensions.Configuration.ConfigurationKeyNameAttribute) to specify the key name in the configuration source. Using this technique, you can map a property in the configuration to one in your code with a different name.
115+
When the names differentiate, you can use the [`ConfigurationKeyName` attribute](xref:Microsoft.Extensions.Configuration.ConfigurationKeyNameAttribute) to specify the key name in the configuration source. Using this technique, you can map a property in the configuration to one in your code with a different name.
116116

117-
This is useful when the property name in the configuration source is not a valid C# identifier, or when you want to use a different name in your code.
117+
This is useful when the property name in the configuration source is not a valid C# identifier or when you want to use a different name in your code.
118118

119-
For example, consider the following Options class:
119+
For example, consider the following options class:
120120

121121
:::code language="csharp" source="~/fundamentals/configuration/options/samples/6.x/OptionsSample/Models/PositionOptionsWithConfigurationKeyName.cs" id="snippet":::
122122

123-
With the following `appsettings.json`, the `Title` and `Name` class properties are bound to the `position-title` and `position-name` from the `appsettings.json` file:
123+
The `Title` and `Name` class properties are bound to the `position-title` and `position-name` from the following `appsettings.json` file:
124124

125125
:::code language="json" source="~/fundamentals/configuration/options/samples/6.x/OptionsSample/appsettings.KN.json":::
126126

aspnetcore/fundamentals/configuration/options/samples/6.x/OptionsSample/Models/PositionOptionsWithConfigurationKeyName.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ public class PositionOptionsWithConfigurationKeyName
66
public const string Position = "Position";
77

88
[ConfigurationKeyName("position-title")]
9-
public string Title { get; set; } = String.Empty;
9+
public string Title { get; set; } = string.Empty;
1010

1111
[ConfigurationKeyName("position-name")]
12-
public string Name { get; set; } = String.Empty;
12+
public string Name { get; set; } = string.Empty;
1313
}
1414
#endregion
1515
}

0 commit comments

Comments
 (0)