how to convert String array to StringBuilder array or vice
versa?
Answer Posted / urukundappa.g
using System;
using System.Text;
class Program
{
static void Main()
{
// Create an array with five strings.
string[] array =
new string["Dot", "Net", "Perls", "Sam", "Allen"];
// Call the methods.
string result1 = ConvertStringArrayToString(array);
string result2 = ConvertStringArrayToStringJoin
(array);
// Display the results.
Console.WriteLine(result1);
Console.WriteLine(result2);
Console.Read();
}
static string ConvertStringArrayToString(string[] array)
{
// Concatenate all the elements into a
StringBuilder.
StringBuilder builder = new StringBuilder();
foreach (string value in array)
{
builder.Append(value);
builder.Append('.');
}
return builder.ToString();
}
StringBuilder [] stringBuilders = builder.ToArray();
Is This Answer Correct ? | 0 Yes | 4 No |
Post New Answer View All Answers
What is application object in c#?
What is difference between throw and throws in c#?
Why singleton is sealed?
What is jit (just in time)?
Why are mutable structs evil?
What is cshtml extension?
Which types of inheritances does c# support?
How do I use the 'using' keyword with multiple objects?
What is the default value of date?
Is a dll an assembly?
What is c# used for?
What is c# console application?
What is oledb in c#?
What is desktop example?
Is stringbuilder faster than string concatenation c#?