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
        {
            [FieldOffset(0)]
            public int Value;
            [FieldOffset(0)]
            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.

hmmm, compiles fine for me

you sure Expression.Valoper is the same class as Valoper?

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?

lol yeh man, it worked fine, will you post the whole class structure then?

commented: inspiring +2

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.