System.CodeDom.CodeCastExpression Class

Assembly: System.dll
Namespace: System.CodeDom
Summary
Represents an expression that is to be cast to a data type or interface.
C# Syntax:
[Serializable]
public class CodeCastExpression : CodeExpression
Remarks
CodeCastExpression can be used to represent an expression that is to be cast to a different data type or interface. The target type to cast to and the CodeExpression to cast are stored as properties of the CodeCastExpression object.
See also:
System.CodeDom Namespace | CodeExpression

System.CodeDom.CodeCastExpression Member List:

Public Constructors
ctor #1 Overloaded:
.ctor()

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the CodeCastExpression class.
ctor #2 Overloaded:
.ctor(CodeTypeReference targetType, CodeExpression expression)

Initializes a new instance of the CodeCastExpression class using the specified cast destination type and expression.
ctor #3 Overloaded:
.ctor(string targetType, CodeExpression expression)

Initializes a new instance of the CodeCastExpression class using the specified cast destination type and expression.
ctor #4 Overloaded:
.ctor(Type targetType, CodeExpression expression)

Initializes a new instance of the CodeCastExpression class using the specified cast destination type and expression.
Public Properties
Expression Read-write

Gets or sets the expression to cast.
TargetType Read-write

Gets or sets the destination type of the cast.
UserData
(inherited from System.CodeDom.CodeObject)
Read-only

See base class member description: System.CodeDom.CodeObject.UserData


Gets or sets the user-definable data for the current object.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.CodeDom.CodeCastExpression Member Details

Overloaded ctor #1
Summary
Initializes a new instance of the CodeCastExpression class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public CodeCastExpression();

Return to top


Overloaded ctor #2
Summary
Initializes a new instance of the CodeCastExpression class using the specified cast destination type and expression.
C# Syntax:
public CodeCastExpression(
   CodeTypeReference targetType,
   CodeExpression expression
);
Parameters:

targetType

A CodeTypeReference that indicates the destination type of the cast.

expression

The CodeExpression to cast.

See also:
CodeExpression

Return to top


Overloaded ctor #3
Summary
Initializes a new instance of the CodeCastExpression class using the specified cast destination type and expression.
C# Syntax:
public CodeCastExpression(
   string targetType,
   CodeExpression expression
);
Parameters:

targetType

The name of the destination type of the cast.

expression

The CodeExpression to cast.

Return to top


Overloaded ctor #4
Summary
Initializes a new instance of the CodeCastExpression class using the specified cast destination type and expression.
C# Syntax:
public CodeCastExpression(
   Type targetType,
   CodeExpression expression
);
Parameters:

targetType

The destination data type of the cast.

expression

The CodeExpression to cast.

Return to top


Property: Expression (read-write)
Summary
Gets or sets the expression to cast.
C# Syntax:
public CodeExpression Expression {get; set;}
See also:
CodeExpression

Return to top


Property: TargetType (read-write)
Summary
Gets or sets the destination type of the cast.
C# Syntax:
public CodeTypeReference TargetType {get; set;}

Return to top


Property: UserData (read-only)
Inherited
See base class member description: System.CodeDom.CodeObject.UserData

Summary
Gets or sets the user-definable data for the current object.
C# Syntax:
public IDictionary UserData {get;}
Remarks


Notes to inheritors: An inheritor can design the way this user data is stored, retrieved, and used.

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~CodeCastExpression();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.