How can I do a method that return a class?

I try this

    public T test<T>()
    	{
    		switch((int)typeBuilding)  // Enumerator
    		{
    		case 0:
    			return Wall;  // class
    			break;
    		case 1:
    			return House;  //class
    			break;
    		}
    	}
    
    GameObject objeto=(GameObject)Instantiate(object,mousePosition(),Quaternion.identity);
    objeto.AddComponent<test()>();	

But dont works, How can I do it? thanks

You can try this :

 case 0:
             return typeof (Wall);
                     break;
 case 1:
             return typeof(House);
                     break;

@andrei2699 , @Tyche10
Thanks, I want to return a Class, not an instance. I have more issues.

    public typeof ChooseScript()
    	{
    		switch((int)buildingType)
    		{
    		case 0:
    			return typeof(Wall);
    			break;
    		case 1:
    			return typeof(House);
    			break;
    		}
    	}

object.AddComponent<ChooseScript()>();

But I have errors, hoe can I do that?. thank you very much.