Q:

How to return an unknown object which contains a specified member variable

There is some code I have seen where the returning object has a Visible member, which can set to be true. I would like to mimic this functionality, but I am getting the error 'object' does not contain a definition for 'Visible' and no extension method 'Visible' accepting a first argument of type 'object' could be found.
Here is the example code that works:
public AP.GlobalClass APObj = new AP.GlobalClass();
APObj.Application().Visible = true;

Here is what I am trying to do that doesn't work:
public APControl.A2APGlobalClass APObj_B = new APControl.A2APGlobalClass();
APObj_B.Application().Visible = true; //Error goes with this line

public class A2APGlobalClass
    {
       public AP.GlobalClass APObj = new AP.GlobalClass();

       public Object Application() //Do I need to change "Object" to something else?
       {
           return APObj.Application(); //This returned object "Object" type does no longer contain the Visible member.
       }

A:

The code may be closed source, but the public members of the types exposed by the assembly must by definition be visible.  If you are working in any kind of decent environment, the intellisense will tell you the return type when you hover your mouse over the member.  If your editor has no intellisense, there are other ways to extract this information.
With reference to @JeroenVannevel's comment, you might want to read up on static vs dynamic typing.  C# is as heart a statically typed language, so you cannot call the Visible property on a reference of type Object, because Object has no Visible property.  Instead of Object, you need to return one of the following:

the actual type of the object being returned
the class in which the Visible property is declared
a type that falls between the two previously mentioned types in the inheritance chain (if there are any such types)
an interface type (if any) implemented by the object being returned and that defines the Visible property

For example, with the types defined below, you could return any of the types except for A:
interface I { bool Visible { get; set; } }
class A { }
class B : I { public bool Visible { get; set; } }
class C : B { }
class D : C { }

