If there are n properties, then is the Big-O of .GetProperties O(n) or are there are processes involved in the reflection that add complexity?
Say there is this defined class:
public class Reflector
{
public string name { get; set; }
public int number { get; set; }
public bool flag { get; set; }
public List<string> etc { get; set; }
}
And then this call is made:
var reflect = new Reflector();
PropertyInfo[] properties = reflect.GetType().GetProperties();
What is the time complexity, i.e. Big-O, of .GetProperties()
? Considering that there are 4 properties, would this only take 4 iterations or is it more complex than that? Or, is it O(1) with some standard set of complexity to get to the list - which seems it must still be O(n) just to build the properties array?