Hi,
I need to create the following statement with CodeDom:

if(_index < _collection.Count - 1)
{
...
}

I wrote the following code:

CodeBinaryOperatorExpression condition = new
CodeBinaryOperatorExpression(
new CodeVariableReferenceExpression("_index"),
CodeBinaryOperatorType.LessThan,
new CodeBinaryOperatorExpression(
  new CodeMethodReferenceExpression(
     new CodeVariableReferenceExpression("_collection"), "Count"),
       CodeBinaryOperatorType.Subtract, new
CodePrimitiveExpression(1)));

The problem is that the code generated is:

if ((_index
          < (_collection.Count - 1)))
{
}

The endline before the boolean condition doesn't permits to compile in
VB.NET whereas in C# it is.
Is there any workaround ?

Thanks
Pierre

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to