How can one convert from a nullable instance of class A to nullable instance of class B, while B is subclass of A, I tried this but it crashes:
class A
{
}
class B:A
{
}
A? instance_1=something_maybe_null;
if (instance_1.GetType() == typeof(B))
{
((B)(instance_1))?.some_method_in_B(paramters);
}
And if I move ? into parathesis, it doesn't compile:
...
if (instance_1.GetType() == typeof(B))
{
((B)(instance_1)?).some_method_in_B(paramters);
}