本文整理汇总了C#中StringList.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# StringList.ToArray方法的具体用法?C# StringList.ToArray怎么用?C# StringList.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList.ToArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomViewEngine
/// <summary>
/// Constructor
/// </summary>
public CustomViewEngine(params string[] additionalLocations)
{
StringList viewLocations = new StringList();
viewLocations.Add("~/Views/{1}/{0}.cshtml");
viewLocations.Add("~/Views/Shared/{0}.cshtml");
viewLocations.AddRange(additionalLocations);
this.PartialViewLocationFormats = viewLocations.ToArray();
this.ViewLocationFormats = viewLocations.ToArray();
}
示例2: ToString
public override string ToString()
{
var list = new StringList();
foreach (var entry in entries)
list.Add(entry.ToString());
return string.Join(" ", list.ToArray());
}
示例3: ReflectionUtilConvertToListTest
public void ReflectionUtilConvertToListTest()
{
StringList stringData = new StringList();
stringData.AddRange("One", "Two", "Three");
List<string> updatedList = ReflectionUtil<string>.ConvertToList(new List<string>(stringData.ToArray()));
Assert.IsNotNull(updatedList);
Assert.AreEqual(stringData[0], updatedList[0]);
Assert.AreEqual(stringData[1], updatedList[1]);
Assert.AreEqual(stringData[2], updatedList[2]);
}
示例4: FIELD
void FIELD(StringList list)
{
ConfigField thisField; var tmpStartIndex = la.charPos;
Expect(5);
list.Add(t.val);
thisField = this.MainField.GetKey(string.Join("/", list.ToArray()), ConfigField.KeyMode.CreateNew);
if (thisField.IsClass)
{
thisField.ToField();
}
thisField.Name = t.val;
KeysAdded.Add(string.Join("/", this.MainField.Key, string.Join("/", list.ToArray())).Replace("//", "/"));
if(this.Range != null && string.Concat("/", string.Join("/", list.ToArray())).Equals(KeyToFind, StringComparison.InvariantCultureIgnoreCase))
{
this.Range.WholeStart = tmpStartIndex;
this.Range.NameStart = t.charPos;
this.Range.NameEnd = t.charPos + t.val.Length;
};
if (la.kind == 11) {
Get();
Expect(12);
}
Expect(13);
object tmp; var beginIndex = la.charPos;
if (la.kind == 8) {
ARRAY(out tmp);
thisField.Array = (object[])tmp;
} else if (la.kind == 1 || la.kind == 2) {
SCALAR(out tmp);
thisField.Number = (double)tmp;
} else if (la.kind == 3 || la.kind == 4) {
STRING(out tmp);
thisField.String = (string)tmp;
} else if (la.kind == 14 || la.kind == 15) {
BOOLEAN(out tmp);
thisField.Boolean = (bool)tmp;
} else if (StartOf(1)) {
Get();
tmp = new StringList(); (tmp as StringList).Add(t.val);
} else SynErr(18);
if (StartOf(2)) {
Get();
tmp = new StringList(); (tmp as StringList).Add(t.val);
while (StartOf(2)) {
Get();
tmp = new StringList(); (tmp as StringList).Add(t.val);
}
thisField.String = string.Join(" ", (tmp as StringList).ToArray());
}
if(this.Range != null && string.Concat("/", string.Join("/", list.ToArray())).Equals(KeyToFind, StringComparison.InvariantCultureIgnoreCase))
{
this.Range.ValueStart = beginIndex;
this.Range.ValueEnd = t.charPos + t.val.Length;
this.Range.WholeEnd = la.charPos + la.val.Length;
}
Expect(10);
list.Remove(list.Last());
}
示例5: CONFIG
void CONFIG(StringList list)
{
ConfigField thisField; var tmpStartIndex = la.charPos;
Expect(6);
Expect(5);
list.Add(t.val);
thisField = this.MainField.GetKey(string.Join("/", list.ToArray()), ConfigField.KeyMode.CreateNew);
if (!thisField.IsClass)
{
thisField.ToClass();
}
thisField.Name = t.val;
if(this.Range != null && string.Concat("/", string.Join("/", list.ToArray())).Equals(KeyToFind, StringComparison.InvariantCultureIgnoreCase))
{
this.Range.WholeStart = tmpStartIndex;
this.Range.NameStart = t.charPos;
this.Range.NameEnd = t.charPos + t.val.Length;
};
if (la.kind == 7) {
Get();
Expect(5);
thisField.ConfigParentName = t.val;
}
if (la.kind == 8) {
Get();
var beginIndex = la.charPos;
while (la.kind == 5 || la.kind == 6) {
if (la.kind == 5) {
FIELD(list);
} else {
CONFIG(list);
}
}
if(this.Range != null && string.Concat("/", string.Join("/", list.ToArray())).Equals(KeyToFind, StringComparison.InvariantCultureIgnoreCase))
{
this.Range.ValueStart = beginIndex;
this.Range.ValueEnd = t.charPos + t.val.Length;
}
Expect(9);
}
Expect(10);
if(this.Range != null && string.Concat("/", string.Join("/", list.ToArray())).Equals(KeyToFind, StringComparison.InvariantCultureIgnoreCase))
{
this.Range.WholeEnd = t.charPos + t.val.Length;
}
KeysAdded.Add(string.Join("/", this.MainField.Key, string.Join("/", list.ToArray())).Replace("//", "/"));
list.Remove(list.Last());
}
示例6: ParseTemplate
private static void ParseTemplate(string template, out string adjustedTemplate, out string[] argNames)
{
// Double brace '{{' is 'escaped brace'. We start by replacing these doubles with \b symbol. At the end we'll replace it back with single brace
template = template.Replace("{{", "\b");
var argNameList = new StringList();
//split by left brace {
var segments = template.Split(new char[]{'{'}, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < segments.Length; i++) {
var segm = segments[i];
if (string.IsNullOrEmpty(segm)) continue;
//find closing brace, extract prop name, replace it with index
var rPos = segm.IndexOf('}');
if (rPos < 0) rPos = segm.Length; // catch error by including all
var argName = segm.Substring(0, rPos);
var tail = segm.Substring(rPos + 1);
argNameList.Add(argName);
segments[i] = "{" + i + "}" + tail; // replace 'propName} abcd' with '{0} abcd'
}
// Merge modified segments
adjustedTemplate = string.Join(string.Empty, segments);
adjustedTemplate = adjustedTemplate.Replace('\b', '{');
argNames = argNameList.ToArray();
}