Apologies if this is duplicate, I'm not familiar enough with the correct terminology to know if this is asked elsewhere. I'm new to interfaces and am creating some sample code to see what kind of helpful things they can achieve. 

I have a method that returns two possible classes that both implement the same interface. However, I can only access the properties from the parent class and not the sub-class, and have failed to find an explanation. I realise my entire approach may be flawed and will accept that advise also.

This is better explained with an example ([NetFiddle](https://dotnetfiddle.net/XHfdHa)) and questions...

```
using System;

public interface IAb
{
    int Prop1 { get; set; }
}

public class A : IAb
{
    public int Prop1 { get; set; }
}

public class B : A, IAb
{
    public string Prop2 { get; set; }
}

public class Program
{
    static class MyMethods
    {
        public static IAb CreateObject(Type t)
        {
            if (t == typeof(A))
            {
                return new A() {Prop1 = 123};
            }
            else
            {
                return new B() {Prop1 = 456, Prop2 = "Foo"};
            }
        }
    }

    public void Main()
    {

        IAb AorB = MyMethods.CreateObject(typeof(B));
        Console.WriteLine(AorB.Prop1);

        if (AorB is B)
        {

            // fails
            // Console.WriteLine((B)AorB.Prop2); // 'IAb' does not contain a definition for 'Prop2'

            // works
            B newVar = (B)AorB;
            Console.WriteLine(newVar.Prop2);

        }
    }
}

```

Based on the above:

1. Why does `AorB.Prop1` work, but not `AorB.Prop2` without an explicit cast?
2. Does the above mean that an interface should always be cast to a class before reading it's properties?
3. Is there a better way to specify the return type of the example method? The current approach feels error-prone because this (albeit unlikely code) would cause an error: `var AorB = (B) MyMethods.CreateObject(typeof(A));`