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
Why do we need generics in c#?
What is the reason behind the invention of c#?
How do namespaces work?
Can we have static indexer in c#?
How can I develop an application that automatically updates itself from the web?
What is private readonly in c#?
What does the parsefloat function do?
Is c# a strongly-typed language?
What does it mean to override a method?
What is callback in c#?
what is object-oriented programming (oop) language?
What is difference between array and arraylist in c#?
What Is A Multicast Delegate?
Why to use “using” in c#?
Does the system.exception class have any cool features?