c# to string code example
Example 1: c sharp int to string
int n = 3;
string number = n.ToString()
Example 2: c# string array to string
string[] test = new string[2];
test[0] = "Hello ";
test[1] = "World!";
string.Join("", test);
Example 3: c# string[] to string
string[] array = new string[3];
array[0] = "orange";
array[1] = "peach";
array[2] = "apple";
string result = string.Join(".", array);
Console.WriteLine($"RESULT: {result}");
Example 4: C# converting to string examples
string onverting
Example 5: to string c# fields
public override String ToString()
{
Type objType = this.GetType();
PropertyInfo[] propertyInfoList = objType.GetProperties();
StringBuilder result = new StringBuilder();
foreach (PropertyInfo propertyInfo in propertyInfoList)
result.AppendFormat("{0}:{1},", propertyInfo.Name, propertyInfo.GetValue(this));
return "{" + result.ToString() + "}";
}