_Core/Lang/AST/Expressions/NewExpr.cs
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Lang.Helpers;
namespace ComLib.Lang
{
/// <summary>
/// New instance creation.
/// </summary>
public class NewExpr : Expr, IParameterExpression
{
/// <summary>
/// Initialize
/// </summary>
public NewExpr()
{
InitBoundary(true, ")");
ParamList = new List<object>();
ParamListExpressions = new List<Expr>();
}
/// <summary>
/// Name of
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// List of expressions.
/// </summary>
public List<Expr> ParamListExpressions { get; set; }
/// <summary>
/// List of arguments.
/// </summary>
public List<object> ParamList { get; set; }
/// <summary>
/// Creates new instance of the type.
/// </summary>
/// <returns></returns>
public override object DoEvaluate()
{
object[] constructorArgs = null;
if (ParamListExpressions != null && ParamListExpressions.Count > 0)
{
ParamList = new List<object>();
FunctionHelper.ResolveParameters(ParamListExpressions, ParamList);
constructorArgs = ParamList.ToArray();
}
if (string.Compare(TypeName, "Date", StringComparison.InvariantCultureIgnoreCase) == 0)
{
DateTime result = LDate.CreateFrom(constructorArgs);
return result;
后面还有 10 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
