public static ValueReference CreateIndexerValueReference(MdbEvaluationContext ctx, TargetObject target, TargetObject[] index)
        {
            TargetFundamentalObject mstr = target as TargetFundamentalObject;

            if (mstr != null && mstr.TypeName == "string")
            {
                // Special case for strings
                string name = "[" + ctx.Evaluator.TargetObjectToExpression(ctx, index[0]) + "]";
                string val  = (string)mstr.GetObject(ctx.Thread);
                object oo   = ctx.Adapter.TargetObjectToObject(ctx, index[0]);
                int    idx  = (int)Convert.ChangeType(oo, typeof(int));
                return(LiteralValueReference.CreateObjectLiteral(ctx, name, val [idx]));
            }

            TargetStructObject sob = target as TargetStructObject;

            if (sob == null)
            {
                return(null);
            }

            TargetPropertyInfo indexerProp = null;

            foreach (MemberReference mem in ObjectUtil.GetTypeMembers(ctx, target.Type, false, true, true, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
            {
                if (mem.Member.IsStatic)
                {
                    continue;
                }
                if (mem.Member is TargetPropertyInfo)
                {
                    TargetPropertyInfo prop = (TargetPropertyInfo)mem.Member;
                    if (prop.CanRead && prop.Getter.ParameterTypes.Length == 1)
                    {
                        indexerProp = prop;
                        break;
                    }
                }
            }
            if (indexerProp != null)
            {
                return(new IndexerValueReference(ctx, sob, index, indexerProp));
            }
            else
            {
                return(null);
            }
        }
        public override ValueReference Evaluate(EvaluationContext ctx, string exp, object expectedType)
        {
            var asType = expectedType as Type;

            if (asType == null)
            {
                // Cannot do anything.
            }
            else if (asType == typeof(string))
            {
                exp = VSCodeObjectSource.Unquote(exp);
                return(LiteralValueReference.CreateObjectLiteral(ctx, exp, exp));
            }
            else if (asType.IsPrimitive)
            {
                return(LiteralValueReference.CreateObjectLiteral(ctx, exp, exp));
            }
            return(base.Evaluate(ctx, exp, expectedType));
        }