How to loop through properties of objects in c#?
<p>I have a method which gets the values of the properties of an object and appends some commas to it. I want to make this generinc so i can use it with other objects.</p>

<pre><code>            foreach (var row in rows.ToList())
            {
                sbResult.Append(
                    delimiter + row.MediaName + delimiter + separator +
                    delimiter + row.CountryName + delimiter + separator +
                    delimiter + row.ItemOverRideDate + delimiter + separator +
                    delimiter + row.Rating + delimiter + separator +
                    delimiter + row.BatchNo + delimiter + separator +
                    delimiter + row.NoInBatch + delimiter + separator +
                    delimiter + row.BatchDate + delimiter + separator +
                    delimiter + row.DataType + delimiter + separator +
                    delimiter + row.ByLine + delimiter + separator +
                    delimiter + row.IssueNo + delimiter + separator +
                    delimiter + row.Issue + delimiter + separator +
                    delimiter + row.MessageNo + delimiter + separator +
                    delimiter + row.Message + delimiter + separator +
                    delimiter + row.SourceName + delimiter + separator +
                    delimiter + row.SourceType + delimiter + separator);

                //end of each row
                sbResult.AppendLine();
            }
</code></pre>

<p>I have tried using <code>var rowData = row.GetType().GetProperties();</code> but it only returns the property itself and I dont know how to get the value of the property.</p>
