本文整理汇总了C#中Mono.CSharp.Constant.ImplicitConversionRequired方法的典型用法代码示例。如果您正苦于以下问题:C# Constant.ImplicitConversionRequired方法的具体用法?C# Constant.ImplicitConversionRequired怎么用?C# Constant.ImplicitConversionRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.Constant
的用法示例。
在下文中一共展示了Constant.ImplicitConversionRequired方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertInitializer
public override Constant ConvertInitializer (ResolveContext rc, Constant expr)
{
if (expr is EnumConstant)
expr = ((EnumConstant) expr).Child;
var underlying = ((Enum) Parent).UnderlyingType;
if (expr != null) {
expr = expr.ImplicitConversionRequired (rc, underlying, Location);
if (expr != null && !IsValidEnumType (expr.Type)) {
Enum.Error_1008 (Location, Report);
expr = null;
}
}
if (expr == null)
expr = New.Constantify (underlying, Location);
return new EnumConstant (expr, MemberType);
}
示例2: ConvertInitializer
public override Constant ConvertInitializer (ResolveContext rc, Constant expr)
{
return expr.ImplicitConversionRequired (rc, rc.BuiltinTypes.Int, Location);
}
示例3: ConvertInitializer
public override Constant ConvertInitializer(ResolveContext rc, Constant expr)
{
return expr.ImplicitConversionRequired (rc, TypeManager.int32_type, Location);
}