CodePrimitiveExpression 类

定义

表示基元数据类型的值。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
继承
CodePrimitiveExpression
属性

示例

下面的示例演示CodePrimitiveExpression如何使用来表示几个基元类型的值。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)

注解

CodePrimitiveExpression可用于表示表达式, 该表达式指示基元数据类型值。CodePrimitiveExpression can be used to represent an expression that indicates a primitive data type value.

Value属性指定要表示的基元数据类型值。The Value property specifies the primitive data type value to represent.

可以使用CodePrimitiveExpression "包括null"、"字符串"、"16-"、"32" 和 "64" 位带符号整数来表示的基元数据类型, 以及单精度和双精度浮点数。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.

构造函数

CodePrimitiveExpression()

初始化 CodePrimitiveExpression 类的新实例。Initializes a new instance of the CodePrimitiveExpression class.

CodePrimitiveExpression(Object)

使用指定的对象初始化 CodePrimitiveExpression 类的新实例。Initializes a new instance of the CodePrimitiveExpression class using the specified object.

属性

UserData

获取当前对象的用户可定义数据。Gets the user-definable data for the current object.

(继承自 CodeObject)
Value

获取或设置要表示的基元数据类型。Gets or sets the primitive data type to represent.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于