Skip to content

Instantly share code, notes, and snippets.

@dshookowsky
Created September 11, 2013 21:04
Show Gist options
  • Save dshookowsky/6529765 to your computer and use it in GitHub Desktop.
Save dshookowsky/6529765 to your computer and use it in GitHub Desktop.
Reader object to expando
private dynamic SqlDataReaderToExpando(DbDataReader reader)
{
var expandoObject = new ExpandoObject() as IDictionary<string, object>;
for (var i = 0; i < reader.FieldCount; i++)
expandoObject.Add(reader.GetName(i), reader[i]);
return expandoObject;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment