Ho la seguente classe genericaCasting una classe generica, senza specifico tipo
public class Home<T> where T : Class
{
public string GetClassType
{
get{ return T.ToString() }
}
}
Ora, sto diventando un oggetto X, che so per certo è la patria:
public void DoSomething(object x)
{
if(x is // Check if Home<>)
{
// I want to invoke GetClassType method of x
// but I don't know his generic type
x as Home<?> // What should I use here?
}
}
Posso anche fare un cast senza specificare il tipo generico della classe?