Export (0) Print
Expand All

CodePrimitiveExpression Class

Represents a primitive data type value.

Namespace: System.CodeDom
Assembly: System (in system.dll)

[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodePrimitiveExpression : CodeExpression
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodePrimitiveExpression extends CodeExpression
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodePrimitiveExpression extends CodeExpression
Not applicable.

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.

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

// 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("Test String");
// Represents an integer.
CodePrimitiveExpression intPrimitive = new 
    CodePrimitiveExpression((Int32)10);
// Represents a floating point number.
CodePrimitiveExpression floatPrimitive = new 
    CodePrimitiveExpression((System.Double)1.03189);
// Represents a null value expression.
CodePrimitiveExpression nullPrimitive = new 
    CodePrimitiveExpression(null);

System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeExpression
      System.CodeDom.CodePrimitiveExpression

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

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft