本文整理汇总了C#中IniFile.SetString方法的典型用法代码示例。如果您正苦于以下问题:C# IniFile.SetString方法的具体用法?C# IniFile.SetString怎么用?C# IniFile.SetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IniFile
的用法示例。
在下文中一共展示了IniFile.SetString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
//.........这里部分代码省略.........
AssertEqual(testIni1.count, 2);
AssertEqual(testIni1.keys.Count, 2);
AssertEqual(testIni1.values.Count, 2);
AssertEqual(testIni1.currentGroup, "Group 1/");
testIni1.SetBool("Subgroup 1/Key 4", true);
AssertEqual(testIni1.count, 3);
AssertEqual(testIni1.keys.Count, 3);
AssertEqual(testIni1.values.Count, 3);
AssertEqual(testIni1.currentGroup, "Group 1/");
testIni1.EndGroup();
AssertEqual(testIni1.count, 4);
AssertEqual(testIni1.keys.Count, 4);
AssertEqual(testIni1.values.Count, 4);
AssertEqual(testIni1.currentGroup, "");
testIni1.SetByteArray("Group 2/Key 5", testBytes);
AssertEqual(testIni1.count, 5);
AssertEqual(testIni1.keys.Count, 5);
AssertEqual(testIni1.values.Count, 5);
AssertEqual(testIni1.currentGroup, "");
testIni1.Set("Group 2/Subgroup 1/Key 6", testPair);
AssertEqual(testIni1.count, 6);
AssertEqual(testIni1.keys.Count, 6);
AssertEqual(testIni1.values.Count, 6);
AssertEqual(testIni1.currentGroup, "");
testIni1.SetString("Group 2/Subgroup 2/Key 7", "Hello World!\t");
//testIni1.EndGroup(); // To check for error
AssertEqual(testIni1.count, 7);
AssertEqual(testIni1.keys.Count, 7);
AssertEqual(testIni1.values.Count, 7);
AssertEqual(testIni1.currentGroup, "");
keys = testIni1.keys;
values = testIni1.values;
AssertEqual(keys[0], "Key 1");
AssertEqual(keys[1], "Group 1/Key 2");
AssertEqual(keys[2], "Group 1/Subgroup 1/Key 3");
AssertEqual(keys[3], "Group 1/Subgroup 1/Key 4");
AssertEqual(keys[4], "Group 2/Key 5");
AssertEqual(keys[5], "Group 2/Subgroup 1/Key 6");
AssertEqual(keys[6], "Group 2/Subgroup 2/Key 7");
AssertEqual(values[0].key, "Key 1");
AssertEqual(values[1].key, "Group 1/Key 2");
AssertEqual(values[2].key, "Group 1/Subgroup 1/Key 3");
AssertEqual(values[3].key, "Group 1/Subgroup 1/Key 4");
AssertEqual(values[4].key, "Group 2/Key 5");
AssertEqual(values[5].key, "Group 2/Subgroup 1/Key 6");
AssertEqual(values[6].key, "Group 2/Subgroup 2/Key 7");
AssertEqual(values[0].value, "1");
AssertEqual(values[1].value, "0.2");
AssertEqual(values[2].value, "0.3");
AssertEqual(values[3].value, "True");
AssertEqual(values[4].value, "010204080F235DA7D8");