e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
99 lines
2.9 KiB
C#
99 lines
2.9 KiB
C#
//------------------------------------------------------------------------------
|
|
// <copyright file="CodeCastExpression.cs" company="Microsoft">
|
|
//
|
|
// <OWNER>[....]</OWNER>
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// </copyright>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace System.CodeDom {
|
|
|
|
using System.Diagnostics;
|
|
using System;
|
|
using Microsoft.Win32;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// Represents a
|
|
/// type cast expression.
|
|
/// </para>
|
|
/// </devdoc>
|
|
[
|
|
ClassInterface(ClassInterfaceType.AutoDispatch),
|
|
ComVisible(true),
|
|
Serializable,
|
|
]
|
|
public class CodeCastExpression : CodeExpression {
|
|
private CodeTypeReference targetType;
|
|
private CodeExpression expression;
|
|
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// Initializes a new instance of <see cref='System.CodeDom.CodeCastExpression'/>.
|
|
/// </para>
|
|
/// </devdoc>
|
|
public CodeCastExpression() {
|
|
}
|
|
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// Initializes a new instance of <see cref='System.CodeDom.CodeCastExpression'/> using the specified
|
|
/// parameters.
|
|
/// </para>
|
|
/// </devdoc>
|
|
public CodeCastExpression(CodeTypeReference targetType, CodeExpression expression) {
|
|
TargetType = targetType;
|
|
Expression = expression;
|
|
}
|
|
|
|
/// <devdoc>
|
|
/// <para>[To be supplied.]</para>
|
|
/// </devdoc>
|
|
public CodeCastExpression(string targetType, CodeExpression expression) {
|
|
TargetType = new CodeTypeReference(targetType);
|
|
Expression = expression;
|
|
}
|
|
|
|
/// <devdoc>
|
|
/// <para>[To be supplied.]</para>
|
|
/// </devdoc>
|
|
public CodeCastExpression(Type targetType, CodeExpression expression) {
|
|
TargetType = new CodeTypeReference(targetType);
|
|
Expression = expression;
|
|
}
|
|
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// The target type of the cast.
|
|
/// </para>
|
|
/// </devdoc>
|
|
public CodeTypeReference TargetType {
|
|
get {
|
|
if (targetType == null) {
|
|
targetType = new CodeTypeReference("");
|
|
}
|
|
return targetType;
|
|
}
|
|
set {
|
|
targetType = value;
|
|
}
|
|
}
|
|
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// The expression to cast.
|
|
/// </para>
|
|
/// </devdoc>
|
|
public CodeExpression Expression {
|
|
get {
|
|
return expression;
|
|
}
|
|
set {
|
|
expression = value;
|
|
}
|
|
}
|
|
}
|
|
}
|