Ive been trying to invoke a count property on a queue. Ive tried all sorts of invoking. How do I get the int value of the count, from the count of a queue?
The syntax im trying to use but doesnt work is
(ConsoleKey)Dequeue.Invoke(InputQueue, new object[] { });
 Type magicType;
        ConstructorInfo magicConstructor;
        object magicClassObject;
        MethodInfo HandleInput;
        MethodInfo UpdateView;
        PropertyInfo IsMenuIdle;
        PropertyInfo InputQueue;
        PropertyInfo Count;
        MethodInfo Dequeue;
        MethodInfo GetCount;
        public GameStateMachine(Type viewMachine)
        {
            magicType = viewMachine; // can replace this with typeof
            magicConstructor = magicType.GetConstructor(new Type[]{ typeof(IGameState) });
            magicClassObject = magicConstructor.Invoke(new object[] { this.CurrentGameState });
            HandleInput = magicType.GetMethod("HandleInput");
            IsMenuIdle = magicType.GetProperty("IsMenuIdle");
            UpdateView = magicType.GetMethod("Update");
            InputQueue = magicType.GetProperty("InputQueue");
            Count = InputQueue.PropertyType.GetProperty("Count");
            Dequeue = InputQueue.PropertyType.GetMethod("Dequeue");
 
Aucun commentaire:
Enregistrer un commentaire