enum use in CodeDOM?

  • Thread starter Thread starter Martijn Hoogendoorn
  • Start date Start date
M

Martijn Hoogendoorn

[Flags]
public enum myEnum
{
a,
b,
c,
d,
e,
}

myEnum c = myEnum.a | myEnum.b | myEnum.c | myEnum.e | ...;

I want to generate the line above, is there any way to do this (language
independent ofcourse)

Thanks!

Martijn
 
Martijn Hoogendoorn said:
[Flags]
public enum myEnum
{
a,
b,
c,
d,
e,
}

myEnum c = myEnum.a | myEnum.b | myEnum.c | myEnum.e | ...;

I want to generate the line above, is there any way to do this (language
independent ofcourse)

Look at CodeBinaryOperatorExpression. It allows you to specify underlying
expressions and an operator.

To chain like that you should be able to simply pass a
CodeBinaryOperatorExpression as one of the expressions in the next
CodeBinaryOperatorExpression.
 
Martijn Hoogendoorn said:
[Flags]
public enum myEnum
{
a,
b,
c,
d,
e,
}

myEnum c = myEnum.a | myEnum.b | myEnum.c | myEnum.e | ...;

I want to generate the line above, is there any way to do this (language
independent ofcourse)

Look at CodeBinaryOperatorExpression. It allows you to specify underlying
expressions and an operator.

To chain like that you should be able to simply pass a
CodeBinaryOperatorExpression as one of the expressions in the next
CodeBinaryOperatorExpression.
Thanks!

Martijn

Works like a charm now, thanks for your help!
 
Back
Top