我的问题是关于c#中的资源文件(.resx).("字符串"部分)我用它来存储我的消息,我想知道如何使用带参数的资源条目的"值"? !
例如:
名称:ShowCellValue值:单元格上的值:?和行:?是:?
我想填写"?" 具有不同值的参数.
谢谢,
您可以对存储在资源文件中的字符串使用string.Format.
将ShowCellValue存储为
string showCellValue = "value on cell {0} and row {1} is {2}";
Run Code Online (Sandbox Code Playgroud)
然后,当您想要使用它时,只需使用ResourceManager:
ResourceManager rm = new ResourceManager("resource root name",
Assembly.GetExecutingAssembly());
MessageBox.Show(string.Format(rm.GetString("showCellValue"),
cellName, rowName, cellValue);
Run Code Online (Sandbox Code Playgroud)