THE RAZI

Hi I have a class named Shopping with two Properties OrderValue and Discount , I have another class where I declare object of Shopping Class

class My Class {

public Shopping shopping;

}

now I want to use codeDom to generate code like

1) this.shopping.OrderValue > 500

II) this.shopping.Discount > 45 && this.shopping.OrderValue >= 500

III) this.shopping.OrderValue != 12 || this.shopping.OrderValue >800 &&

this.shopping.Discount <= 90

I need c# code in format like

new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(
new CodeThisReferenceExpression(), "OrderValue"),
CodeBinaryOperatorType.GreaterThan,
new CodePrimitiveExpression(500)));

I will also encourage if some one also points to some parser or other resourse that

can create CodeDom generation code (like see below ) into c#

<ns0:CodeBinaryOperatorExpression Operator="GreaterThan" xmlns:ns0="clr-namespace:System.CodeDom;Assembly=System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<ns0:CodeBinaryOperatorExpression.Left>

<ns0:CodePropertyReferenceExpression PropertyName="OrderValue">

<ns0:CodePropertyReferenceExpression.TargetObject>

<ns0:CodeFieldReferenceExpression FieldName="shoping">

<ns0:CodeFieldReferenceExpression.TargetObject>

<ns0:CodeThisReferenceExpression />

</ns0:CodeFieldReferenceExpression.TargetObject>

</ns0:CodeFieldReferenceExpression>

</ns0:CodePropertyReferenceExpression.TargetObject>

</ns0:CodePropertyReferenceExpression>

</ns0:CodeBinaryOperatorExpression.Left>

<ns0:CodeBinaryOperatorExpression.Right>

<ns0:CodePrimitiveExpression>

<ns0:CodePrimitiveExpression.Value>

<ns1:Int32 xmlns:ns1="clr-namespace:System;Assembly=mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">500</ns1:Int32>

</ns0:CodePrimitiveExpression.Value>

</ns0:CodePrimitiveExpression>

</ns0:CodeBinaryOperatorExpression.Right>

</ns0:CodeBinaryOperatorExpression>