CodePrimitiveExpression Class
Collapse the table of content
Expand the table of content

CodePrimitiveExpression Class

Represents a primitive data type value.

For a list of all members of this type, see CodePrimitiveExpression Members.


[Visual Basic]
Public Class CodePrimitiveExpression
   Inherits CodeExpression
public class CodePrimitiveExpression : CodeExpression
public __gc class CodePrimitiveExpression : public
class CodePrimitiveExpression extends CodeExpression

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


CodePrimitiveExpression can be used to represent an expression that indicates a primitive data type value.

The Value property specifies the primitive data type value to represent.

Primitive data types that can be represented using CodePrimitiveExpression include a null reference (Nothing in Visual Basic); string; 16-, 32-, and 64-bit signed integers; and single-precision and double-precision floating-point numbers.


[Visual Basic, C#, C++] The following example demonstrates use of CodePrimitiveExpression to represent values of several primitive types.

[Visual Basic] 
' Represents a string.
Dim stringPrimitive As New CodePrimitiveExpression("Test String")
' Represents an integer.
Dim intPrimitive As New CodePrimitiveExpression(10)
' Represents a floating point number.
Dim floatPrimitive As New CodePrimitiveExpression(1.03189)
' Represents a null value expression.
Dim nullPrimitive As New CodePrimitiveExpression(Nothing)

// Represents a string.
CodePrimitiveExpression stringPrimitive = new CodePrimitiveExpression("Test String");
// Represents an integer.
CodePrimitiveExpression intPrimitive = new CodePrimitiveExpression(10);
// Represents a floating point number.
CodePrimitiveExpression floatPrimitive = new CodePrimitiveExpression(1.03189);
// Represents a null value expression.
CodePrimitiveExpression nullPrimitive = new CodePrimitiveExpression(null);            

// Represents a string.
CodePrimitiveExpression* stringPrimitive = new CodePrimitiveExpression(S"Test String");
// Represents an integer.
CodePrimitiveExpression* intPrimitive = new CodePrimitiveExpression(__box(10));
// Represents a floating point number.
CodePrimitiveExpression* floatPrimitive = new CodePrimitiveExpression(__box(1.03189));
// Represents a null value expression.
CodePrimitiveExpression* nullPrimitive = new CodePrimitiveExpression(0);            

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.CodeDom

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

CodePrimitiveExpression Members | System.CodeDom Namespace

© 2016 Microsoft