Type.GetProperties not returning any properties
c#, properties
Solution
public ushort Fps;
public ushort Height;
...
They are not properties but fields. Try `GetFields` instead. Or, probably better, convert them to properties. E.g.
public ushort Fps {get; set;}
public ushort Height {get; set;}
Problem
I'm trying to loop through every property in a class, output the name of the property and the value. But my code isn't returning any properties. class being looped through: ``` public class GameOptions { public ushort Fps; public ushort Height; public ushort Width; public bool FreezeOnFocusLost; public bool ShowCursor; public bool StaysOnTop; public bool EscClose; public string Title; public bool Debug; public int DebugInterval = 500; } ``` Code used to loop through them all: ``` foreach (PropertyInfo property in this.Options.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { debugItems.Add("Setting Name: " + property.Name); debugItems.Add("Setting Value: " + property.GetValue(this,null)); } ``` however when I change `public ushort Fps;` to `public ushort Fps { get; set; }` it will find it.