Question: Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3.

Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has.

Is there a way for me to determine at run-time that it has public members foo1, foo2, foo3 *AND ONLY* foo1, foo2, foo3. IE - find out what all the public members are?

And can I also determine their types?

Answer: 
You could use reflection:

```
// List all public properties for the given type
PropertyInfo[] properties = foo.GetType().GetProperties();
foreach (var property in properties)
{
    string propertyName = property.Name;
}

```

You should be aware that there could be an additional overhead when using reflection because types are evaluated at runtime.
Following article on [MSDN](http://msdn.microsoft.com/en-us/library/t0cs7xez%28v=VS.80%29.aspx) should help you determine the methods of a type