I have written a function which collects from a two dimensional array. The issue I am having it that I used a string builder to put them both into one string but I would like a break in between
public static string[,] ArrSkills = new string[,]
{
{ "Live The Dream More" },
{ "And Even More" }
};
public static void WriteSkills()
{
StringBuilder Builder = new StringBuilder();
foreach (string s in ArrSkills)
{
Builder.AppendLine(s);
}
GetSkills = Builder.ToString(); ;
}
The output at the moment is "Live The Dream MoreAnd Even More" when using AppendLine the output has two unknown character symbols where the line break should be. I am writing to a custom XML linked to content controls. I was just wondering how would I be able to spit the array so both parts go on separate lines;
Live The Dream More
And Even More
Just incase any one would like to know I have sorted this issue for getting a break point for my project any way. What I did was use the content control as plain text and then set the properties to "Allow carriage returns". From there I use the code
StringBuilder Builder = new StringBuilder();
string Spacing = Environment.NewLine;
string newline = "";
foreach (string s in ArrSkills)
{
newline = string.Format("{0}{1}", Spacing, s);
foreach (var Item in newline)
{
Builder.Append(Item);
}
}
GetSkills = Builder.ToString();
with allowing Allowing carriage the method for Environment.NewLine allows a line break
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.