本文整理汇总了C#中IniFile.BeginGroup方法的典型用法代码示例。如果您正苦于以下问题:C# IniFile.BeginGroup方法的具体用法?C# IniFile.BeginGroup怎么用?C# IniFile.BeginGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IniFile
的用法示例。
在下文中一共展示了IniFile.BeginGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
//.........这里部分代码省略.........
AssertEqual(values[2].comment, "Comment 4");
AssertEqual(values[3].comment, "");
AssertEqual(values[4].comment, "Comment 8");
AssertEqual(values[5].comment, "");
AssertEqual(values[6].comment, "Comment 10");
AssertEqual(values[7].comment, "");
AssertEqual(values[8].comment, "Comment 12");
AssertEqual(values[9].comment, "");
AssertEqual(testIni1.ToString(),
"; Comment 2\n" +
"Key 1 = 2\n" +
"Key 3 = 0.1\n" +
"; Comment 4\n" +
"Key 6 = 0.2\n" +
"Key 5 = 0.1\n" +
"; Comment 8\n" +
"Key 8 = False\n" +
"Key 9 = 010204080F235DA7D8\n" +
"; Comment 10\n" +
"Key 10 = 010204080F235DA7D8\n" +
"Key 11 = [KeyPair: key=1, value=2, comment=3]\n" +
"; Comment 12\n" +
"Key 12 = [KeyPair: key=1, value=2, comment=3]\n" +
"Key 13 = \" Hello\"\n");
testIni2.Parse(testIni1.ToString());
AssertEqual(testIni1, testIni2);
#endregion
// ---------------------------------------------------------------------------------
#region IniFile Clear function
testIni1.BeginGroup("MyGroup");
AssertEqual(testIni1.currentGroup, "MyGroup/");
testIni1.Clear();
testIni2.Clear();
AssertEqual(testIni1.count, 0);
AssertEqual(testIni1.keys.Count, 0);
AssertEqual(testIni1.values.Count, 0);
AssertEqual(testIni1.currentGroup, "");
AssertEqual(testIni2.currentGroup, "");
AssertEqual(testIni1.ToString(), "");
AssertEqual(testIni1, testIni2);
#endregion
#endregion
// ===================================================================================
#region IniFile groups
#region IniFile Set function
testIni1.SetInt("Key 1", 1);
AssertEqual(testIni1.count, 1);
AssertEqual(testIni1.keys.Count, 1);
AssertEqual(testIni1.values.Count, 1);
AssertEqual(testIni1.currentGroup, "");
testIni1.BeginGroup("Group 1");
testIni1.SetFloat("Key 2", 0.2f);
AssertEqual(testIni1.count, 1);
AssertEqual(testIni1.keys.Count, 1);