How to use CodeObjectCreateExpression for System.DateTime in C# codeDom

Apr 22 2009 8:25 AM
Here i the method 'BOOL()' returns a Boolean value. Now i need to do similar thing of returning a DateTime value. When i used,

new CodePrimitiveExpression(DATETIME());


where 'DATETIME()' returns a DateTime value. But i got the below exception when i tried CodePrimitiveExpression,

Invalid Primitive Type: System.DateTime. Consider using CodeObjectCreateExpression.

So how can i use CodeObjectExpression to get a DateTime value.?

Here is the code snippet attached.

if (p.ParameterType == typeof(System.Boolean))
                return new CodeVariableDeclarationStatement(p.ParameterType, options.sVariableNamePrix + p.Name,
                    new CodePrimitiveExpression(BOOL()));
else if (p.ParameterType == typeof(System.DateTime))
                return new CodeVariableDeclarationStatement(p.ParameterType, options.sVariableNamePrix + p.Name,
                   // new CodeObjectCreateExpression(DATETIME()));