For example I have a simple class like
public class Person{ public int Age {get;set;} public string Name {get;set;} }
I need to make a method that takes any class and spits out values of properties set in the object as a string in format ‘Age:35;Name:John Doe;’
I am looking for a method signature on the lines of
public string SpitNameValuePairs<T>()
or something like it. How can this be done efficiently if using reflection?
That have protection from crashes when property have an indexer defined and also it output only instance properties (no static).