Created
November 22, 2014 23:09
-
-
Save jerry4/2e3f64c7abf23daf8295 to your computer and use it in GitHub Desktop.
create fields from anonymous type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// resharper has a refactoring for this but I use it in LinqPad. This works for very simple cases to save me some typing | |
foreach(var prop in anon.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public)) | |
{ | |
Console.WriteLine("\tpublic {0} {1};", prop.PropertyType, prop.Name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment