本文整理汇总了C#中Config.setStringList方法的典型用法代码示例。如果您正苦于以下问题:C# Config.setStringList方法的具体用法?C# Config.setStringList怎么用?C# Config.setStringList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config.setStringList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PutGetStringList
public void PutGetStringList()
{
Config c = new Config();
List<string> values = new List<string>();
values.Add("value1");
values.Add("value2");
c.setStringList("my", null, "somename", values);
object[] expArr = values.ToArray();
string[] actArr = c.getStringList("my", null, "somename");
Assert.IsTrue(expArr.SequenceEqual(actArr));
string expText = "[my]\n\tsomename = value1\n\tsomename = value2\n";
Assert.AreEqual(expText, c.toText());
}
示例2: Update
/// <summary>
/// Update this remote's definition within the configuration.
/// </summary>
/// <param name="rc">the configuration file to store ourselves into.</param>
public void Update(Config rc)
{
if (rc == null)
throw new ArgumentNullException ("rc");
var vlst = new List<string>();
vlst.Clear();
foreach (URIish u in URIs)
{
vlst.Add(u.ToPrivateString());
}
rc.setStringList(Section, Name, KeyUrl, vlst);
vlst.Clear();
foreach (URIish u in PushURIs)
vlst.Add(u.ToPrivateString());
rc.setStringList(Section, Name, KeyPushurl, vlst);
vlst.Clear();
foreach (RefSpec u in Fetch)
{
vlst.Add(u.ToString());
}
rc.setStringList(Section, Name, KeyFetch, vlst);
vlst.Clear();
foreach (RefSpec u in Push)
{
vlst.Add(u.ToString());
}
rc.setStringList(Section, Name, KeyPush, vlst);
Set(rc, KeyUploadpack, UploadPack, DEFAULT_UPLOAD_PACK);
Set(rc, KeyReceivepack, ReceivePack, DEFAULT_RECEIVE_PACK);
Set(rc, KeyTagopt, TagOpt.Option, TagOpt.AUTO_FOLLOW.Option);
Set(rc, KeyMirror, Mirror, DefaultMirror);
Set(rc, KeyTimeout, Timeout, 0);
if (oldName != Name) {
rc.unsetSection (Section, oldName);
oldName = Name;
}
}