<p>Is there something like <a href="http://effbot.org/zone/python-getattr.htm" rel="noreferrer">Python's getattr()</a> in C#? I would like to create a window by reading a list which contains the names of controls to put on the window.</p>

Use reflection for this.
```
Type.GetProperty()
```
and
```
Type.GetProperties()
```
each return
```
PropertyInfo
```
instances, which can be used to read a property value on an object.
```
```
var result = typeof(DateTime).GetProperty("Year").GetValue(dt, null)
```
```
```
Type.GetMethod()
```
and
```
Type.GetMethods()
```
each return
```
MethodInfo
```
instances, which can be used to execute a method on an object.
```
```
var result = typeof(DateTime).GetMethod("ToLongDateString").Invoke(dt, null);
```
```
If you don't necessarily know the type (which would be a little wierd if you new the property name), than you could do something like this as well.
```
```
var result = dt.GetType().GetProperty("Year").Invoke(dt, null);
```
```