本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}