jeudi 6 avril 2017

Determining which base constructor a constructor calls

Say that I have a class like this:

public class DisplayTextCommand : Command
{
    public DisplayTextCommand(byte[] data) : base(0x05, 0x00, 0x00, data) { }
}

I know how to use reflection to get the information that I need a byte[] in order to create this object. I also know how to use it to find out that the parameter's name is data.

I can even determine that the base type (Command) has a constructor which takes (byte, byte, byte, byte[]) and the names of those parameters. But I can't figure out how to tell that DisplayTextCommand() is passing specific values to that base constructor.

How can I get the values in base(0x05, 0x00, 0x00, data) using reflection?





Aucun commentaire:

Enregistrer un commentaire