CodePrimitiveExpression CodePrimitiveExpression CodePrimitiveExpression CodePrimitiveExpression Class

Definition

Represents a primitive data type value.

public ref class CodePrimitiveExpression : System::CodeDom::CodeExpression
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodePrimitiveExpression : System.CodeDom.CodeExpression
type CodePrimitiveExpression = class
    inherit CodeExpression
Public Class CodePrimitiveExpression
Inherits CodeExpression
Inheritance
CodePrimitiveExpressionCodePrimitiveExpressionCodePrimitiveExpressionCodePrimitiveExpression
Attributes

Examples

The following example demonstrates use of CodePrimitiveExpression to represent values of several primitive types.

// Represents a string.
CodePrimitiveExpression^ stringPrimitive = gcnew CodePrimitiveExpression( "Test String" );

// Represents an integer.
CodePrimitiveExpression^ intPrimitive = gcnew CodePrimitiveExpression( 10 );

// Represents a floating point number.
CodePrimitiveExpression^ floatPrimitive = gcnew CodePrimitiveExpression( 1.03189 );

// Represents a null value expression.
CodePrimitiveExpression^ nullPrimitive = gcnew CodePrimitiveExpression( 0 );

// 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.
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)

Remarks

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 null; string; 16-, 32-, and 64-bit signed integers; and single-precision and double-precision floating-point numbers.

Constructors

CodePrimitiveExpression() CodePrimitiveExpression() CodePrimitiveExpression() CodePrimitiveExpression()

Initializes a new instance of the CodePrimitiveExpression class.

CodePrimitiveExpression(Object) CodePrimitiveExpression(Object) CodePrimitiveExpression(Object) CodePrimitiveExpression(Object)

Initializes a new instance of the CodePrimitiveExpression class using the specified object.

Properties

UserData UserData UserData UserData

Gets the user-definable data for the current object.

(Inherited from CodeObject)
Value Value Value Value

Gets or sets the primitive data type to represent.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to