Supposing we have two classes that implement a common interface.

```
public interface IContract
{
    int Type  { get; }
}

public class XClass : IContract
{
    public int Type  { get; set; }
    public int X { get; set; }
}

public class YClass : IContract
{
    public int Type  { get; set; }
    public int Y { get; set; }
}

```

Now, As you know, when we assign a class to the implemented interface, the interface instance contain all the data of the assigned class boxed inside.

```
IContract ic = new XClass();

```

There should be a way to detect the datatype of the value within the interface variable ic.

If(ic contains XClass datatype) Then ...
If(ic contains YClass datatype) Then ...

I'd be glad if anyone can help me to detect the datatype assigned to the interface instance. Thanks.