I'm using a function from an external assembly that returns an object which is a list of an internal class and I cannot find a way to cast it in my code.
Code in the external assembly:
namespace AssemblyNamespace
{
internal class InternalClass
{
protected internal byte b;
protected internal int i;
}
public class PublicClass
{
public object PublicMethod()
{
return new List<InternalClass>();
}
}
}
My code:
using AssemblyNamespace;
static void Main()
{
PublicClass P = new PublicClass();
object obj = new object();
obj = P.PublicMethod();
// Is it possible to cast obj?
}
Is it possible to cast obj through reflection or something else? I took a look at question C# - How to access internal class from external assembly but could not find a way to use their suggestions.
Aucun commentaire:
Enregistrer un commentaire