The best way is to just return the actual type you're dealing with from the method
But if that's not an option, and you really are stuck with just object being returned from your method, you have a few options.
If you know the right type, casting would be the simplest way:
((ActualType)x).SomeProperty;
Or to test that the cast is correct:
string val; if (x is ActualType) val = (x as ActualType).SomeProperty;
Or, if you know the property name, but not the type of x, then:
PropertyInfo pi = x.GetType().GetProperty("SomeProperty"); string somePropertyValue = (string)pi.GetValue(x, null);
Or, if you're using C# 4, you could use dynamic
string somePropertyValue = ((dynamic)x).SomeProperty;
Just don't go crazy with dynamic. If you find yourself using dynamic excessively, there may be some deeper issues with your code.
myObjectMethodisobject?