将对象传递给方法重载范围

我正在尝试简化正在构建的服务器上的Send函数。我想通过发送数据来减少发送数据的方法的数量,以便在参数中指定发送的信息。

例如,从许多类似的方法中获取:

    public static void QueryUsername( string text )
    {
        PacketBuffer buffer = new PacketBuffer();

        buffer.Write( Outbound.DoesUserExist );
        buffer.Write( text );
        ClientTCP.SendData( buffer.ToArray() );
        buffer.Dispose();
    }

对于这样的单个方法:

    public static void Send( Outbound packageIndex, params object[] parameter )
    {
        PacketBuffer buffer = new PacketBuffer();
        buffer.Write( packageIndex );

        foreach ( object item in parameter )
        {
            buffer.Write( item );
        }

        ClientTCP.SendData( buffer.ToArray() );
        buffer.Dispose();
    }

I'm having difficulty figuring out how to pass the parameter data through the Write method though.

有人对我如何实现这一目标有任何建议吗?

The Write method has 5 overloads that transform different types into bytes so they can be packaged and sent between the client and server.