Is it possible in C# to explicitly convert a base class object array to one of it's derived class object array? I have class C derived from class A and I'm trying to convert the base class object array to the derived class object array but it returns returns a null value.
public interface I
{
public string Name;
public string Id;
}
public class A
{
public string name;
public string id;
}
public class B: A,I
{
public string Name
{
get { return name; }
set{name= value;}
}
public string Id
{
get { return id; }
set{id= value;}
}
}
A[] baseClassList= GetValues();
B[] derivedClassList= baseClassList as B[];---THIS IS RETURNING NULL
How can i solve this? Any help is appreciated.