Reputation: 109
Settings.settings
<Setting Name="user_create" Type="System.String" Scope="Application">
<Value Profile="(Default)">A user {0} is created.</Value>
</Setting>
UserServices.cs
userService.DescriptionMessage= Settings.Default.user_create + userName;
If user created the name "Michael"
Now the value of DescriptionMessage is "A user {0} is created.Michael".
I would like to get the value of DescriptionMessage as the following.
"A user Michael is created.".
How should I update in the service?
Best Regards
Upvotes: 0
Views: 39
Reputation: 2931
This will work...
userService.DescriptionMessage= string.Format(Settings.Default.user_create, userName);
Upvotes: 1
Reputation: 151588
You want to call string.Format()
to replace {0}
with userName
:
userService.DescriptionMessage = string.Format(Settings.Default.user_create, userName);
Upvotes: 1