示例#1
0
 string IDkmClrFullNameProvider.GetClrCastExpression(
     DkmInspectionContext inspectionContext,
     string argument,
     DkmClrType type,
     DkmClrCustomTypeInfo customTypeInfo,
     DkmClrCastExpressionOptions castExpressionOptions
     )
 {
     throw new NotImplementedException();
 }
示例#2
0
        string IDkmClrFullNameProvider.GetClrCastExpression(
            DkmInspectionContext inspectionContext,
            string argument,
            DkmClrType type,
            DkmClrCustomTypeInfo customTypeInfo,
            DkmClrCastExpressionOptions castExpressionOptions
            )
        {
            bool sawInvalidIdentifier;
            var  name = GetTypeName(
                new TypeAndCustomInfo(type, customTypeInfo),
                escapeKeywordIdentifiers: true,
                sawInvalidIdentifier: out sawInvalidIdentifier
                );

            if (sawInvalidIdentifier)
            {
                return(null);
            }
            return(GetCastExpression(argument, name, castExpressionOptions));
        }
示例#3
0
        internal override string GetCastExpression(
            string argument,
            string type,
            DkmClrCastExpressionOptions options
            )
        {
            Debug.Assert(!string.IsNullOrEmpty(argument));
            Debug.Assert(!string.IsNullOrEmpty(type));

            var pooled  = PooledStringBuilder.GetInstance();
            var builder = pooled.Builder;

            if ((options & DkmClrCastExpressionOptions.ParenthesizeEntireExpression) != 0)
            {
                builder.Append('(');
            }
            if ((options & DkmClrCastExpressionOptions.ParenthesizeArgument) != 0)
            {
                argument = $"({argument})";
            }
            if ((options & DkmClrCastExpressionOptions.ConditionalCast) != 0)
            {
                builder.Append(argument);
                builder.Append(" as ");
                builder.Append(type);
            }
            else
            {
                builder.Append('(');
                builder.Append(type);
                builder.Append(')');
                builder.Append(argument);
            }
            if ((options & DkmClrCastExpressionOptions.ParenthesizeEntireExpression) != 0)
            {
                builder.Append(')');
            }

            return(pooled.ToStringAndFree());
        }
示例#4
0
 internal abstract string GetCastExpression(
     string argument,
     string type,
     DkmClrCastExpressionOptions options
     );