what does this string.format piece of code do?
- by jbkkd
I have this piece of code in c#:
private static void _constructRow(SqlDataReader reader, system.IO.StreamWriter stwr, bool getColumnName)
{
for (int i = 0; i < reader.FieldCount; i++)
stwr.Writeline(String.Format("<td>{0}</td"), getColumnName ? reader.GetName(i) : reader.GetValue(i).ToString()));
}
I'm trying to understand what the part that start with "getColumnName ?" and ends with ".ToString()" does. I understood that it is a system.object type, but I have no idea what it specifically does or how it works.
I want that because of this: "reader" had multiple rows in it, and I want to writeline only specific rows.
If anyone can help me on either of those, I'd be grateful.