C# 访问包含在另一个类中的类中的方法,而不引用包含的类

C# 访问包含在另一个类中的类中的方法,而不引用包含的类,c#,class,monogame,C#,Class,Monogame,我有一个Screen类,其中包含Monogame的SpriteBatch。我想访问SpriteBatch.Draw()方法,而不必执行Screen.SpriteBatch.Draw(),而是: screen.Draw(sprite, position, color); 我可以这样定义方法: class Screen { public void Draw(Texture2D texture, Rectangle rect, Color color) { sprit

我有一个
Screen
类,其中包含Monogame的
SpriteBatch
。我想访问
SpriteBatch.Draw()
方法,而不必执行
Screen.SpriteBatch.Draw()
,而是:

screen.Draw(sprite, position, color);
我可以这样定义方法:

class Screen
{
    public void Draw(Texture2D texture, Rectangle rect, Color color)
    {
        spriteBatch.Draw(texture, rect, color);
    }
    public void Draw(Texture2D texture, Vector2 position, Color color)
    {
        spriteBatch.Draw(texture, position, color);
    }

    .... and so on for every other override of SpriteBatch.Draw
}
但这显然很长,我不想手动键入每个覆盖


有更简单的方法吗?

让Screen类继承自SpriteBatch,代码如下:

Screen : SpriteBatch

您确定您已经在正确的级别抽象了功能吗?您已经为屏幕提供了spritebatch,通常这意味着您希望屏幕负责使用sprintbatch绘制一些东西,比如场景、复杂的动作等,而不仅仅是表示所包含类使用的相同功能。