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
Explain about WSDL
What is dataview c#?
What are generic types?
What's the difference between system.string and system.text.stringbuilder classes?
Why do we need oops in c#?
What is difference between array and list in c#?
Can we instantiate abstract class in c#?
Why do we need generics?
if we are updating a database using thread, and mean while application crashes or thread being aborted then what will happen in Database? Rollback or Database will be updated? Please explain with different scenario.
Can private virtual methods be overridden in c#.net?
Which class does the remote object has to inherit?
What is a derived class in c#?
How to sign an assembly with strong name?
What is difference between ienumerable and iqueryable in c#?
When can a derived class override a base class member?