Busy writing an infix to postfix converter.(I'm a strange guy. I like to do those things from time to time...)
I have a class Expression which is in essence :

[StructLayout(LayoutKind.Explicit)] //in c/c++ this is a union
        public struct Valoper
            public int Value;
            public Oper Operand;
        public Queue<Valoper> RPN = new Queue<Valoper>();

        public Queue<Valoper> InfixToPostfix(string expr)
            //change expr to postfix
            return RPN;

Btw wonder why they left out the union keyword in C#.
I found this "way" to do it in C# on MSDN.
In my Main I have :

Expression E = new Expression();
            Queue<Expression.Valoper> Output = E.InfixToPostfix(InputStr);

The last line gives me the error message

Error 1 Cannot implicitly convert type 'System.Collections.Generic.Queue<ConsoleInfixToPostfix.Expression.Valoper>' to 'System.Collections.Generic.Queue<Valoper>

I'm using VS 2008 Express C# here.
What am I doing wrong? Any help would be nice.

9 Years
Discussion Span
Last Post by ddanbe

The struct Valoper is defined in the Expression class.
The line with the error I have is called from Main in the Program class. I don't know why it shouldn't work, that's why I posted it here.
Did you really tried it out and it worked at your place?


Still wondering 'bout the error message. Difference between pro and express versions? I will mark this as solved.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.