Answers for "convert model into string c#"

C#
1

c# convert object to string

Object obj=new Object();
obj="hi";

string str1=Convert.ToString(obj);
string str2=obj.ToString();
string str3= obj as string;
string str4=(string)obj;
Posted by: Guest on December-10-2020
0

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() + "}";
     }
Posted by: Guest on September-08-2020

Code answers related to "convert model into string c#"

C# Answers by Framework

Browse Popular Code Answers by Language