0

I have the following text in a resource file.

Hello {{studentName}},
Your schedule is  ....

Is there a way to set the placeholder {{studentName}} to a given value, before loading the resource file? I've done this with strings, but not a resource file.

Greg
  • 747
  • 9
  • 23
  • 1
    I'm not clear what you mean by "resource file". Resource (.res/.resx) files can contain text resources, or you can include an arbitrary file as a resource, load the resource data and convert it to a string for text manipulation, Or sometimes "resource files" can refer to a file on disk separate from the exe. I can't tell from your question what the structure of your application is, so you'll need to provide more precise information about what you're asking about. – Paul Dempsey Apr 13 '23 at 20:31
  • I went through some of my old notes and found a solution. It's an resx file: App_LocalResources\Contact.aspx.resx file. My solution is in the edit – Greg Apr 13 '23 at 20:35
  • 1
    @Greg What about using `string.Format()` or a simple `Replace()` on the string? – Progman Apr 13 '23 at 20:35

1 Answers1

0

OK ... I feel dumb answering my own question, but here goes.

I just need to use the same formatting for strings. Update the file to show

Hello {0},
Your schedule is  ....


string.Format((string)GetLocalResourceObject("ContactText"), "Mike");

Too obvious I guess ...

Greg
  • 747
  • 9
  • 23