Advertisement
kromm77

C# Object Properties into a Dictionary

Mar 3rd, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.20 KB | None | 0 0
  1. List<string> list = new List<string>();
  2. PropertyInfo[] fields = object.GetType().GetProperties();
  3. foreach (PropertyInfo f in fields)
  4. {
  5.     list.Add( f.Name, string.Format("{0}", f.GetValue(object)));
  6. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement