本文整理汇总了C#中KnownTypeCode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# KnownTypeCode.ToString方法的具体用法?C# KnownTypeCode.ToString怎么用?C# KnownTypeCode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnownTypeCode
的用法示例。
在下文中一共展示了KnownTypeCode.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindType
public IType FindType(KnownTypeCode typeCode)
{
switch(typeCode){
case KnownTypeCode.Void:
return FindType(BVEPrimitiveTypeCode.None);
case KnownTypeCode.Int32:
return FindType(BVEPrimitiveTypeCode.Integer);
case KnownTypeCode.Double:
return FindType(BVEPrimitiveTypeCode.Float);
case KnownTypeCode.String:
return FindType(BVEPrimitiveTypeCode.Name);
default:
return new UnknownType("global", typeCode.ToString(), 0);
}
}
示例2: CreateDefaultValue
LiteralExpression CreateDefaultValue(KnownTypeCode type)
{
LiteralExpression result = null;
var loc = CurrentLocation;
var type_name = type.ToString().ToLower();
switch(type){
case KnownTypeCode.Int:
case KnownTypeCode.UInt:
case KnownTypeCode.Byte:
result = Expression.MakeConstant(type_name, 0, loc);
break;
case KnownTypeCode.Bool:
result = Expression.MakeConstant(type_name, false, loc);
break;
case KnownTypeCode.Float:
result = Expression.MakeConstant(type_name, 0.0, loc);
break;
case KnownTypeCode.String:
result = Expression.MakeConstant(type_name, "", loc);
break;
case KnownTypeCode.Char:
result = Expression.MakeConstant(type_name, '\0', loc);
break;
default:
SemanticError("Error ES0030: Unknown object type");
break;
}
return result;
}