当前位置: 首页>>代码示例>>C#>>正文


C# Type.IsPrimitiveTypeConvertibleToRef方法代码示例

本文整理汇总了C#中Type.IsPrimitiveTypeConvertibleToRef方法的典型用法代码示例。如果您正苦于以下问题:C# Type.IsPrimitiveTypeConvertibleToRef方法的具体用法?C# Type.IsPrimitiveTypeConvertibleToRef怎么用?C# Type.IsPrimitiveTypeConvertibleToRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Type的用法示例。


在下文中一共展示了Type.IsPrimitiveTypeConvertibleToRef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintExpression

        private bool? PrintExpression(Type type, Expression expression, ref string result)
        {
            var desugared = type.Desugar();

            // constants are obtained through dynamic calls at present so they are not compile-time values in target languages
            if (expression.Declaration is Variable ||
                (!Options.MarshalCharAsManagedChar &&
                 desugared.IsPrimitiveType(PrimitiveType.UChar)) ||
                type.IsPrimitiveTypeConvertibleToRef())
                return null;

            if (CheckForDefaultPointer(desugared, ref result))
                return true;

            if (expression.Class == StatementClass.Call)
            {
                if (expression.Declaration.Ignore)
                {
                    result = null;
                    return false;
                }
                return null;
            }

            var defaultConstruct = CheckForDefaultConstruct(desugared, expression, ref result);
            if (defaultConstruct != false)
                return defaultConstruct;

            return CheckForSimpleExpressions(expression, ref result, desugared);
        }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:30,代码来源:HandleDefaultParamValuesPass.cs

示例2: PrintExpression

        private bool? PrintExpression(Type type, Expression expression, ref string result)
        {
            var desugared = type.Desugar();

            if ((!Driver.Options.MarshalCharAsManagedChar &&
                 desugared.IsPrimitiveType(PrimitiveType.UChar)) ||
                type.IsPrimitiveTypeConvertibleToRef())
                return null;

            if (CheckForDefaultPointer(desugared, ref result))
                return true;

            if (expression.Class == StatementClass.Call)
                return expression.Declaration.Ignore ? false : (bool?) null;

            var defaultConstruct = CheckForDefaultConstruct(desugared, expression, ref result);
            if (defaultConstruct != false)
                return defaultConstruct;

            return CheckForSimpleExpressions(expression, ref result, desugared);
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:21,代码来源:HandleDefaultParamValuesPass.cs

示例3: CheckForDefaultPointer

        private bool CheckForDefaultPointer(Type desugared, ref string result)
        {
            if (!desugared.IsPointer())
                return false;

            // IntPtr.Zero is not a constant
            if (desugared.IsPointerToPrimitiveType(PrimitiveType.Void))
            {
                result = "new global::System.IntPtr()";
                return true;
            }

            if (desugared.IsPrimitiveTypeConvertibleToRef())
                return false;

            Class @class;
            if (desugared.GetFinalPointee().TryGetClass(out @class) && @class.IsValueType)
            {
                result = string.Format("new {0}()",
                    new CSharpTypePrinter(Context).VisitClassDecl(@class));
                return true;
            }

            result = "null";
            return true;
        }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:26,代码来源:HandleDefaultParamValuesPass.cs

示例4: PrintExpression

        private bool? PrintExpression(Type type, Expression expression, ref string result)
        {
            var desugared = type.Desugar();

            if ((!Driver.Options.MarshalCharAsManagedChar &&
                 desugared.IsPrimitiveType(PrimitiveType.UChar)) ||
                type.IsPrimitiveTypeConvertibleToRef())
                return null;

            if (CheckForDefaultPointer(desugared, ref result))
                return true;

            var defaultConstruct = CheckForDefaultConstruct(desugared, expression, ref result);
            if (defaultConstruct != false)
                return defaultConstruct;

            return CheckFloatSyntax(desugared, expression, ref result) ||
                CheckForBinaryOperator(desugared, expression, ref result) ||
                CheckForEnumValue(desugared, expression, ref result) ||
                CheckForDefaultEmptyChar(desugared, expression, ref result);
        }
开发者ID:farawayzheng,项目名称:CppSharp,代码行数:21,代码来源:HandleDefaultParamValuesPass.cs


注:本文中的Type.IsPrimitiveTypeConvertibleToRef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。