本文整理汇总了C#中Section.GetCreateEmptySection方法的典型用法代码示例。如果您正苦于以下问题:C# Section.GetCreateEmptySection方法的具体用法?C# Section.GetCreateEmptySection怎么用?C# Section.GetCreateEmptySection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section.GetCreateEmptySection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveGroupContentTo
private static void SaveGroupContentTo(RepositoryGroup group, Section section)
{
Assert.IsNotNull(group);
Assert.IsNotNull(section);
int id;
var groupsSection = section.GetCreateEmptySection("Groups");
id = 0;
foreach(var subGroup in group.Groups)
{
var subGroupSection = groupsSection.CreateSection(string.Format(CultureInfo.InvariantCulture, "Group{0}", id++));
SaveGroupTo(subGroup, subGroupSection);
}
var repositoriesSection = section.GetCreateEmptySection("Repositories");
id = 0;
foreach(var repository in group.Respositories)
{
var repositorySection = repositoriesSection.CreateSection(string.Format(CultureInfo.InvariantCulture, "Repository{0}", id++));
SaveRepositoryTo(repository, repositorySection);
}
}
示例2: SaveTo
public void SaveTo(Section section)
{
Verify.Argument.IsNotNull(section, "section");
var localRepositories = section.GetCreateEmptySection("LocalRepositories");
if(_local.Groups.Count != 0 && _local.Respositories.Count != 0)
{
SaveGroupTo(_local, localRepositories);
}
var recentRepositories = section.GetCreateEmptySection("RecentRepositories");
if(_recent.Count != 0)
{
int id = 0;
foreach(var repository in _recent)
{
var repositorySection = recentRepositories.CreateSection(string.Format(CultureInfo.InvariantCulture, "Repository{0}", id++));
SaveRepositoryTo(repository, repositorySection);
}
}
}