Bewerken

Delen via


CodePrimitiveExpression Class

Definition

Represents a primitive data type value.

public ref class CodePrimitiveExpression : System::CodeDom::CodeExpression
public class CodePrimitiveExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodePrimitiveExpression : System.CodeDom.CodeExpression
type CodePrimitiveExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodePrimitiveExpression = class
    inherit CodeExpression
Public Class CodePrimitiveExpression
Inherits CodeExpression
Inheritance
CodePrimitiveExpression
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()

Initializes a new instance of the CodePrimitiveExpression class.

CodePrimitiveExpression(Object)

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

Properties

UserData

Gets the user-definable data for the current object.

(Inherited from CodeObject)
Value

Gets or sets the primitive data type to represent.

Methods

Equals(Object)

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

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to