Skip to content

Instantly share code, notes, and snippets.

@mii9000
Forked from dshookowsky/gist:6529765
Created October 23, 2015 17:27
Show Gist options
  • Save mii9000/d5e6405233d749a3d5a2 to your computer and use it in GitHub Desktop.
Save mii9000/d5e6405233d749a3d5a2 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